<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://openlakehouse.io/w/index.php?action=history&amp;feed=atom&amp;title=Iceberg_position_delete</id>
	<title>Iceberg position delete - Revision history</title>
	<link rel="self" type="application/atom+xml" href="https://openlakehouse.io/w/index.php?action=history&amp;feed=atom&amp;title=Iceberg_position_delete"/>
	<link rel="alternate" type="text/html" href="https://openlakehouse.io/w/index.php?title=Iceberg_position_delete&amp;action=history"/>
	<updated>2026-12-06T00:08:02Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.43.11</generator>
	<entry>
		<id>https://openlakehouse.io/w/index.php?title=Iceberg_position_delete&amp;diff=95&amp;oldid=prev</id>
		<title>Open Lakehouse Wiki sync: Sync from open-lakehouse/wiki@f2492a3</title>
		<link rel="alternate" type="text/html" href="https://openlakehouse.io/w/index.php?title=Iceberg_position_delete&amp;diff=95&amp;oldid=prev"/>
		<updated>2026-11-23T00:34:51Z</updated>

		<summary type="html">&lt;p&gt;Sync from open-lakehouse/wiki@f2492a3&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;{{Infobox concept&lt;br /&gt;
| name            = Iceberg position delete&lt;br /&gt;
| also_known_as   = Position delete file; positional delete&lt;br /&gt;
| field           = Table formats&lt;br /&gt;
| introduced      = [[Apache Iceberg]] format version 2&lt;br /&gt;
| key_parts       = Data file path, row position, optional deleted row values&lt;br /&gt;
| implementations = [[Apache Iceberg]]&lt;br /&gt;
| related         = [[Deletion vector]], [[Copy-on-write and merge-on-read]], [[Small files problem]]&lt;br /&gt;
}}&lt;br /&gt;
{{Verified|2026-11-22|the Apache Iceberg table spec at tags apache-iceberg-1.8.0, apache-iceberg-1.11.0 and apache-iceberg-1.12.0, the Iceberg 1.8.0, 1.9.0, 1.11.0 and 1.12.0 release notes, TableMetadata.java and the configuration, Spark queries and Spark procedures documentation at apache-iceberg-1.12.0}}&lt;br /&gt;
{{Status|deprecated |since=Iceberg format version 3 |replacement=[[Deletion vector|deletion vectors]] |note=Writers must not add position delete files to v3 tables; existing ones in tables upgraded from v2 stay valid. Position delete files remain the normal merge-on-read output for v2 tables, and v2 is still the default format version in Iceberg 1.12.0. |ref=&amp;lt;ref name=&amp;quot;spec&amp;quot;&amp;gt;{{Cite web |url=https://github.com/apache/iceberg/blob/apache-iceberg-1.12.0/format/spec.md |title=Iceberg Table Spec (format/spec.md at apache-iceberg-1.12.0) |publisher=Apache Software Foundation |access-date=2026-11-22}}&amp;lt;/ref&amp;gt;}}&lt;br /&gt;
&lt;br /&gt;
In [[Apache Iceberg]], a &amp;#039;&amp;#039;&amp;#039;position delete&amp;#039;&amp;#039;&amp;#039; marks one row as deleted by naming the data file that holds it and the row&amp;#039;s position in that file, counting from zero. In format version 2, position deletes are stored in &amp;#039;&amp;#039;&amp;#039;position delete files&amp;#039;&amp;#039;&amp;#039;, which are separate data files of (file path, position) pairs that readers apply when they scan the table.&amp;lt;ref name=&amp;quot;spec&amp;quot; /&amp;gt; Format version 3 deprecates position delete files and stores position deletes as [[deletion vector]]s instead, one bitmap per data file.&amp;lt;ref name=&amp;quot;spec&amp;quot; /&amp;gt; Position delete files are one of the ways Iceberg implements [[Copy-on-write and merge-on-read|merge-on-read]].&lt;br /&gt;
&lt;br /&gt;
== Status ==&lt;br /&gt;
The Iceberg table spec marks position delete files as deprecated in format version 3. Its section on position delete files says that existing position deletes must be written to deletion vectors when the deletes for a data file are next updated, and the row-level delete section says that position delete files must not be added to v3 tables, but existing position delete files are valid.&amp;lt;ref name=&amp;quot;spec&amp;quot; /&amp;gt; The same rules are in the spec at the apache-iceberg-1.8.0 tag, the first release that could write deletion vectors.&amp;lt;ref name=&amp;quot;spec180&amp;quot;&amp;gt;{{Cite web |url=https://github.com/apache/iceberg/blob/apache-iceberg-1.8.0/format/spec.md |title=Iceberg Table Spec (format/spec.md at apache-iceberg-1.8.0) |publisher=Apache Software Foundation |access-date=2026-11-22}}&amp;lt;/ref&amp;gt;&amp;lt;ref name=&amp;quot;releases&amp;quot;&amp;gt;{{Cite web |url=https://iceberg.apache.org/releases/ |title=Apache Iceberg Releases |publisher=Apache Software Foundation |access-date=2026-11-22}}&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The deprecation applies to the format version, not to the Iceberg library. Iceberg 1.12.0 still creates new tables with format version 2 unless &amp;lt;code&amp;gt;format-version&amp;lt;/code&amp;gt; is set, and in a v2 table a merge-on-read &amp;lt;code&amp;gt;DELETE&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;UPDATE&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;MERGE&amp;lt;/code&amp;gt; still writes position delete files.&amp;lt;ref name=&amp;quot;tablemeta&amp;quot;&amp;gt;{{Cite web |url=https://github.com/apache/iceberg/blob/apache-iceberg-1.12.0/core/src/main/java/org/apache/iceberg/TableMetadata.java |title=TableMetadata.java (apache-iceberg-1.12.0) |publisher=Apache Software Foundation |access-date=2026-11-22}}&amp;lt;/ref&amp;gt;&amp;lt;ref name=&amp;quot;config&amp;quot;&amp;gt;{{Cite web |url=https://github.com/apache/iceberg/blob/apache-iceberg-1.12.0/docs/docs/configuration.md |title=Configuration (docs/docs/configuration.md at apache-iceberg-1.12.0) |publisher=Apache Software Foundation |access-date=2026-11-22}}&amp;lt;/ref&amp;gt; Position delete files are deprecated only for tables that have moved to format version 3 or later.&lt;br /&gt;
&lt;br /&gt;
One part of the v2 design has been deprecated and removed in the Java library. The v2 spec allows a position delete file to also store the deleted row&amp;#039;s values, but the spec notes that no implementation writes them; the Java implementation deprecated reading and writing that column in 1.11.0, and the 1.12.0 release notes list the removal of position delete files with row data.&amp;lt;ref name=&amp;quot;spec&amp;quot; /&amp;gt;&amp;lt;ref name=&amp;quot;releases&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== How it works ==&lt;br /&gt;
A position delete file stores rows of a struct called &amp;lt;code&amp;gt;file_position_delete&amp;lt;/code&amp;gt;. Each row has a &amp;lt;code&amp;gt;file_path&amp;lt;/code&amp;gt;, the full URI of the target data file, and a &amp;lt;code&amp;gt;pos&amp;lt;/code&amp;gt;, the ordinal position of the deleted row in that file. A third, optional column, &amp;lt;code&amp;gt;row&amp;lt;/code&amp;gt;, can hold the deleted row&amp;#039;s values.&amp;lt;ref name=&amp;quot;spec&amp;quot; /&amp;gt; The rows must be sorted by &amp;lt;code&amp;gt;file_path&amp;lt;/code&amp;gt; and then &amp;lt;code&amp;gt;pos&amp;lt;/code&amp;gt;, so that a columnar reader can skip entries for other files and can apply deletes while it streams through a data file instead of holding them in memory.&amp;lt;ref name=&amp;quot;spec&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
At read time, a position delete file applies to a data file in the same partition whose data sequence number is less than or equal to the delete file&amp;#039;s, unless a deletion vector already covers that data file. Because the comparison includes equal sequence numbers, a delete can remove rows added in the same commit.&amp;lt;ref name=&amp;quot;spec&amp;quot; /&amp;gt; One position delete file can hold deletes for many data files. When all its deletes are for one data file, the manifest entry can record that file in &amp;lt;code&amp;gt;referenced_data_file&amp;lt;/code&amp;gt;, which lets planners skip the delete file for every other data file.&amp;lt;ref name=&amp;quot;spec&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Each delete operation adds new delete files, so a table that takes many small row-level changes collects many small position delete files. Iceberg provides the &amp;lt;code&amp;gt;rewrite_position_delete_files&amp;lt;/code&amp;gt; Spark procedure to compact them and to drop entries that point to data files that are no longer live.&amp;lt;ref name=&amp;quot;procs&amp;quot;&amp;gt;{{Cite web |url=https://github.com/apache/iceberg/blob/apache-iceberg-1.12.0/docs/docs/spark-procedures.md |title=Spark Procedures (docs/docs/spark-procedures.md at apache-iceberg-1.12.0) |publisher=Apache Software Foundation |access-date=2026-11-22}}&amp;lt;/ref&amp;gt; This is one form of the [[small files problem]].&lt;br /&gt;
&lt;br /&gt;
== Position delete file compared with related mechanisms ==&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! !! Position delete file !! Deletion vector !! Equality delete file&lt;br /&gt;
|-&lt;br /&gt;
! Format versions&lt;br /&gt;
| v2; deprecated in v3, not allowed for new writes&amp;lt;ref name=&amp;quot;spec&amp;quot; /&amp;gt;&lt;br /&gt;
| v3 and later&amp;lt;ref name=&amp;quot;spec&amp;quot; /&amp;gt;&lt;br /&gt;
| v2 and later&amp;lt;ref name=&amp;quot;spec&amp;quot; /&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! Identifies rows by&lt;br /&gt;
| Data file path and row position&lt;br /&gt;
| Row position, as a bitmap tied to one data file&lt;br /&gt;
| Values of one or more columns, such as &amp;lt;code&amp;gt;id = 5&amp;lt;/code&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! Files per data file&lt;br /&gt;
| Many; any number of delete files can cover a data file&lt;br /&gt;
| At most one per data file in a snapshot&lt;br /&gt;
| Many&lt;br /&gt;
|-&lt;br /&gt;
! Stored as&lt;br /&gt;
| A Parquet, Avro or ORC file; the spec recommends the table&amp;#039;s default file format&lt;br /&gt;
| A blob in a Puffin file&lt;br /&gt;
| A Parquet, Avro or ORC file&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;ref name=&amp;quot;spec&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Equality deletes are not affected by the v3 change. They delete rows by value rather than by position, and v3 tables can still add them.&amp;lt;ref name=&amp;quot;spec&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Upgrading to format version 3 ==&lt;br /&gt;
When a v2 table is upgraded to v3, its existing position delete files stay in table metadata and still apply. The first time a writer adds a deletion vector for a data file, it must merge that file&amp;#039;s existing position deletes into the vector, and from then on readers can ignore position delete files that match a data file with a vector.&amp;lt;ref name=&amp;quot;spec&amp;quot; /&amp;gt; A position delete file that covers several data files has to stay in metadata until every data file it covers has a deletion vector.&amp;lt;ref name=&amp;quot;spec&amp;quot; /&amp;gt; Iceberg 1.9.0 added a Spark action to rewrite v2 position deletes as v3 deletion vectors.&amp;lt;ref name=&amp;quot;releases&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Example ==&lt;br /&gt;
In Spark with an Iceberg catalog, a merge-on-read &amp;lt;code&amp;gt;DELETE&amp;lt;/code&amp;gt; on a v2 table writes a position delete file, which the &amp;lt;code&amp;gt;position_deletes&amp;lt;/code&amp;gt; metadata table shows:&amp;lt;ref name=&amp;quot;queries&amp;quot;&amp;gt;{{Cite web |url=https://github.com/apache/iceberg/blob/apache-iceberg-1.12.0/docs/docs/spark-queries.md |title=Spark Queries (docs/docs/spark-queries.md at apache-iceberg-1.12.0) |publisher=Apache Software Foundation |access-date=2026-11-22}}&amp;lt;/ref&amp;gt;&amp;lt;ref name=&amp;quot;config&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;sql&amp;quot;&amp;gt;&lt;br /&gt;
CREATE TABLE demo.db.orders (id BIGINT, status STRING)&lt;br /&gt;
USING iceberg&lt;br /&gt;
TBLPROPERTIES (&amp;#039;format-version&amp;#039; = &amp;#039;2&amp;#039;, &amp;#039;write.delete.mode&amp;#039; = &amp;#039;merge-on-read&amp;#039;);&lt;br /&gt;
&lt;br /&gt;
INSERT INTO demo.db.orders VALUES (1, &amp;#039;open&amp;#039;), (2, &amp;#039;open&amp;#039;), (3, &amp;#039;closed&amp;#039;);&lt;br /&gt;
DELETE FROM demo.db.orders WHERE id = 2;&lt;br /&gt;
&lt;br /&gt;
SELECT file_path, pos, delete_file_path FROM demo.db.orders.position_deletes;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
With &amp;lt;code&amp;gt;&amp;#039;format-version&amp;#039; = &amp;#039;3&amp;#039;&amp;lt;/code&amp;gt;, the same &amp;lt;code&amp;gt;DELETE&amp;lt;/code&amp;gt; writes a deletion vector instead; Iceberg 1.8.0 added support for showing deletion vectors in the &amp;lt;code&amp;gt;position_deletes&amp;lt;/code&amp;gt; table.&amp;lt;ref name=&amp;quot;releases&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== See also ==&lt;br /&gt;
* [[Deletion vector]]&lt;br /&gt;
* [[Copy-on-write and merge-on-read]]&lt;br /&gt;
* [[Apache Iceberg]]&lt;br /&gt;
* [[Small files problem]]&lt;br /&gt;
* [[Open table format]]&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
&amp;lt;references /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{{Navbox open lakehouse}}&lt;br /&gt;
&lt;br /&gt;
[[Category:Concepts]]&lt;br /&gt;
[[Category:Glossary terms]]&lt;br /&gt;
[[Category:Table formats]]&lt;/div&gt;</summary>
		<author><name>Open Lakehouse Wiki sync</name></author>
	</entry>
</feed>