Iceberg position delete
| Also known as | Position delete file; positional delete |
|---|---|
| Field | Table formats |
| Introduced | Apache Iceberg format version 2 |
| Key parts | Data file path, row position, optional deleted row values |
| Open source implementations | Apache Iceberg |
| Related | Deletion vector, Copy-on-write and merge-on-read, Small files problem |
In Apache Iceberg, a position delete marks one row as deleted by naming the data file that holds it and the row's position in that file, counting from zero. In format version 2, position deletes are stored in position delete files, which are separate data files of (file path, position) pairs that readers apply when they scan the table.[1] Format version 3 deprecates position delete files and stores position deletes as deletion vectors instead, one bitmap per data file.[1] Position delete files are one of the ways Iceberg implements merge-on-read.
Status
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.[1] The same rules are in the spec at the apache-iceberg-1.8.0 tag, the first release that could write deletion vectors.[2][3]
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 format-version is set, and in a v2 table a merge-on-read DELETE, UPDATE or MERGE still writes position delete files.[4][5] Position delete files are deprecated only for tables that have moved to format version 3 or later.
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'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.[1][3]
How it works
A position delete file stores rows of a struct called file_position_delete. Each row has a file_path, the full URI of the target data file, and a pos, the ordinal position of the deleted row in that file. A third, optional column, row, can hold the deleted row's values.[1] The rows must be sorted by file_path and then pos, 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.[1]
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'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.[1] 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 referenced_data_file, which lets planners skip the delete file for every other data file.[1]
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 rewrite_position_delete_files Spark procedure to compact them and to drop entries that point to data files that are no longer live.[6] This is one form of the small files problem.
| Position delete file | Deletion vector | Equality delete file | |
|---|---|---|---|
| Format versions | v2; deprecated in v3, not allowed for new writes[1] | v3 and later[1] | v2 and later[1] |
| Identifies rows by | Data file path and row position | Row position, as a bitmap tied to one data file | Values of one or more columns, such as id = 5
|
| Files per data file | Many; any number of delete files can cover a data file | At most one per data file in a snapshot | Many |
| Stored as | A Parquet, Avro or ORC file; the spec recommends the table's default file format | A blob in a Puffin file | A Parquet, Avro or ORC file |
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.[1]
Upgrading to format version 3
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'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.[1] A position delete file that covers several data files has to stay in metadata until every data file it covers has a deletion vector.[1] Iceberg 1.9.0 added a Spark action to rewrite v2 position deletes as v3 deletion vectors.[3]
Example
In Spark with an Iceberg catalog, a merge-on-read DELETE on a v2 table writes a position delete file, which the position_deletes metadata table shows:[7][5]
CREATE TABLE demo.db.orders (id BIGINT, status STRING)
USING iceberg
TBLPROPERTIES ('format-version' = '2', 'write.delete.mode' = 'merge-on-read');
INSERT INTO demo.db.orders VALUES (1, 'open'), (2, 'open'), (3, 'closed');
DELETE FROM demo.db.orders WHERE id = 2;
SELECT file_path, pos, delete_file_path FROM demo.db.orders.position_deletes;
With 'format-version' = '3', the same DELETE writes a deletion vector instead; Iceberg 1.8.0 added support for showing deletion vectors in the position_deletes table.[3]
See also
- Deletion vector
- Copy-on-write and merge-on-read
- Apache Iceberg
- Small files problem
- Open table format
References
- ↑ 1.00 1.01 1.02 1.03 1.04 1.05 1.06 1.07 1.08 1.09 1.10 1.11 1.12 1.13 1.14 1.15 Iceberg Table Spec (format/spec.md at apache-iceberg-1.12.0). Apache Software Foundation.Retrieved 2026-11-22.
- ↑ Iceberg Table Spec (format/spec.md at apache-iceberg-1.8.0). Apache Software Foundation.Retrieved 2026-11-22.
- ↑ 3.0 3.1 3.2 3.3 Apache Iceberg Releases. Apache Software Foundation.Retrieved 2026-11-22.
- ↑ TableMetadata.java (apache-iceberg-1.12.0). Apache Software Foundation.Retrieved 2026-11-22.
- ↑ 5.0 5.1 Configuration (docs/docs/configuration.md at apache-iceberg-1.12.0). Apache Software Foundation.Retrieved 2026-11-22.
- ↑ Spark Procedures (docs/docs/spark-procedures.md at apache-iceberg-1.12.0). Apache Software Foundation.Retrieved 2026-11-22.
- ↑ Spark Queries (docs/docs/spark-queries.md at apache-iceberg-1.12.0). Apache Software Foundation.Retrieved 2026-11-22.