<?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=Deletion_vector</id>
	<title>Deletion vector - Revision history</title>
	<link rel="self" type="application/atom+xml" href="https://openlakehouse.io/w/index.php?action=history&amp;feed=atom&amp;title=Deletion_vector"/>
	<link rel="alternate" type="text/html" href="https://openlakehouse.io/w/index.php?title=Deletion_vector&amp;action=history"/>
	<updated>2026-12-06T00:08:08Z</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=Deletion_vector&amp;diff=64&amp;oldid=prev</id>
		<title>Open Lakehouse Wiki sync: Sync from open-lakehouse/wiki@9783fe6</title>
		<link rel="alternate" type="text/html" href="https://openlakehouse.io/w/index.php?title=Deletion_vector&amp;diff=64&amp;oldid=prev"/>
		<updated>2026-11-22T21:29:53Z</updated>

		<summary type="html">&lt;p&gt;Sync from open-lakehouse/wiki@9783fe6&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            = Deletion vector&lt;br /&gt;
| also_known_as   = DV&lt;br /&gt;
| field           = Table formats&lt;br /&gt;
| introduced      = Delta Lake 2.3.0 (reads); Apache Iceberg format version 3&lt;br /&gt;
| key_parts       = Bitmap of deleted row positions (64-bit Roaring bitmap), reference to one data file, cardinality&lt;br /&gt;
| implementations = [[Delta Lake]], [[Apache Iceberg]]&lt;br /&gt;
| related         = [[Copy-on-write and merge-on-read]], [[Small files problem]], [[Apache Parquet]]&lt;br /&gt;
}}&lt;br /&gt;
{{Verified|2026-11-22|Delta Lake PROTOCOL.md at tag v4.4.1 and the Delta Lake deletion vectors documentation, the Apache Iceberg table spec and Puffin spec at tag apache-iceberg-1.12.0, and the Iceberg maintenance documentation}}&lt;br /&gt;
&lt;br /&gt;
A &amp;#039;&amp;#039;&amp;#039;deletion vector&amp;#039;&amp;#039;&amp;#039; (DV) is a compact bitmap, stored outside a data file, that marks which rows of that data file are deleted. Readers skip the marked rows, so a table can delete or update individual rows without rewriting the immutable data file that holds them.&amp;lt;ref name=&amp;quot;deltaproto&amp;quot;&amp;gt;{{Cite web |url=https://github.com/delta-io/delta/blob/v4.4.1/PROTOCOL.md |title=Delta Transaction Log Protocol (PROTOCOL.md at v4.4.1) |publisher=Delta Lake (Linux Foundation) |access-date=2026-11-22}}&amp;lt;/ref&amp;gt;&amp;lt;ref name=&amp;quot;icespec&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; Deletion vectors are one way of implementing the merge-on-read strategy for row-level changes. [[Delta Lake]] and [[Apache Iceberg]] (from format version 3) both define them, and the two encodings are closely related.&lt;br /&gt;
&lt;br /&gt;
== How it works ==&lt;br /&gt;
A deletion vector is a set of row positions in one data file, counting from zero. In both formats the set is a 64-bit Roaring bitmap: each 64-bit position is split into a 32-bit key (the high bytes) and a 32-bit sub-position, and each key points to a 32-bit Roaring bitmap of sub-positions.&amp;lt;ref name=&amp;quot;deltaproto&amp;quot; /&amp;gt;&amp;lt;ref name=&amp;quot;puffin&amp;quot;&amp;gt;{{Cite web |url=https://github.com/apache/iceberg/blob/apache-iceberg-1.12.0/format/puffin-spec.md |title=Puffin file format (format/puffin-spec.md at apache-iceberg-1.12.0) |publisher=Apache Software Foundation |access-date=2026-11-22}}&amp;lt;/ref&amp;gt; Roaring bitmaps switch between an integer array, a bitmap and run-length encoding per block of values, which keeps both sparse and dense deletes small.&amp;lt;ref name=&amp;quot;deltaproto&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
A row is deleted if its position is set in the deletion vector that applies to its data file. The table metadata records which data file a deletion vector belongs to and how many rows it removes (its cardinality).&amp;lt;ref name=&amp;quot;deltaproto&amp;quot; /&amp;gt;&amp;lt;ref name=&amp;quot;icespec&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Approach !! What is written for a one-row delete !! What a reader does&lt;br /&gt;
|-&lt;br /&gt;
| Copy-on-write || A new copy of the whole data file without the row || Reads the new data file&lt;br /&gt;
|-&lt;br /&gt;
| Position delete file (Iceberg v2) || A file listing (data file path, row position) pairs || Treats a row as deleted if a delete file has an entry for its file and position&lt;br /&gt;
|-&lt;br /&gt;
| Deletion vector || A bitmap for that single data file || Skips the set positions while reading the data file&lt;br /&gt;
|}&lt;br /&gt;
The rows of this table are drawn from the Iceberg delete format definitions and the Delta Lake deletion vector documentation.&amp;lt;ref name=&amp;quot;icespec&amp;quot; /&amp;gt;&amp;lt;ref name=&amp;quot;deltadoc&amp;quot;&amp;gt;{{Cite web |url=https://docs.delta.io/delta-deletion-vectors/ |title=What are deletion vectors? |publisher=Delta Lake |access-date=2026-11-22}}&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Delta Lake ==&lt;br /&gt;
In the Delta transaction log protocol, deletion vectors are a table feature. A table must use reader version 3 and writer version 7 and list &amp;lt;code&amp;gt;deletionVectors&amp;lt;/code&amp;gt; in both its reader and writer features. Writers may only create new deletion vectors when the table property &amp;lt;code&amp;gt;delta.enableDeletionVectors&amp;lt;/code&amp;gt; is true, but readers must honour existing deletion vectors whether or not the property is set.&amp;lt;ref name=&amp;quot;deltaproto&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
A deletion vector is attached to a file&amp;#039;s &amp;lt;code&amp;gt;add&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;remove&amp;lt;/code&amp;gt; action through a descriptor with a &amp;lt;code&amp;gt;storageType&amp;lt;/code&amp;gt;: &amp;lt;code&amp;gt;u&amp;lt;/code&amp;gt; for a file whose path is derived from a UUID relative to the table, &amp;lt;code&amp;gt;p&amp;lt;/code&amp;gt; for an absolute path, or &amp;lt;code&amp;gt;i&amp;lt;/code&amp;gt; for a bitmap stored inline in the log, base85-encoded. The descriptor also holds the offset, size in bytes and cardinality. Deletion vector files live in the table root and can hold vectors for data files in several partitions.&amp;lt;ref name=&amp;quot;deltaproto&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The protocol&amp;#039;s reader requirement is that rows invalidated by a deletion vector must not be returned. Its writer requirement is that a file added with a deletion vector must carry a correct &amp;lt;code&amp;gt;numRecords&amp;lt;/code&amp;gt; statistic.&amp;lt;ref name=&amp;quot;deltaproto&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Support arrived across several releases. According to the Delta Lake documentation, scans with deletion vectors are available from 2.3.0, &amp;lt;code&amp;gt;DELETE&amp;lt;/code&amp;gt; from 2.4.0, &amp;lt;code&amp;gt;UPDATE&amp;lt;/code&amp;gt; from 3.0.0 and &amp;lt;code&amp;gt;MERGE&amp;lt;/code&amp;gt; from 3.1.0. The same page marks the feature as being in experimental support mode.&amp;lt;ref name=&amp;quot;deltadoc&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;sql&amp;quot;&amp;gt;&lt;br /&gt;
-- Delta Lake: enable deletion vectors (upgrades the table protocol)&lt;br /&gt;
ALTER TABLE events SET TBLPROPERTIES (&amp;#039;delta.enableDeletionVectors&amp;#039; = true);&lt;br /&gt;
&lt;br /&gt;
-- Later: rewrite every file that has soft-deleted rows&lt;br /&gt;
REORG TABLE events APPLY (PURGE);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Enabling deletion vectors upgrades the table protocol, after which clients without deletion vector support cannot read the table. From Delta Lake 3.0 the table feature can be dropped again to restore compatibility.&amp;lt;ref name=&amp;quot;deltadoc&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Apache Iceberg ==&lt;br /&gt;
Format version 3 of the Iceberg spec adds binary deletion vectors. They are stored as the &amp;lt;code&amp;gt;deletion-vector-v1&amp;lt;/code&amp;gt; blob type in Puffin files and tracked in delete manifests by file location, blob offset (&amp;lt;code&amp;gt;content_offset&amp;lt;/code&amp;gt;) and length (&amp;lt;code&amp;gt;content_size_in_bytes&amp;lt;/code&amp;gt;), together with the referenced data file.&amp;lt;ref name=&amp;quot;icespec&amp;quot; /&amp;gt; One Puffin file can hold deletion vectors for many data files.&amp;lt;ref name=&amp;quot;icespec&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Deletion vectors replace position delete files in version 3. Position delete files are deprecated, must not be added to v3 tables, and existing ones stay valid until the deletes for that data file are next updated, at which point they must be written into a deletion vector.&amp;lt;ref name=&amp;quot;icespec&amp;quot; /&amp;gt; Equality delete files are unaffected and remain the way to delete rows by column value.&amp;lt;ref name=&amp;quot;icespec&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The spec allows at most one deletion vector per data file in a snapshot. Writers must merge new deletes with the existing vector or position delete files, so when a deletion vector is present, readers can ignore matching position delete files.&amp;lt;ref name=&amp;quot;icespec&amp;quot; /&amp;gt; At read time, a deletion vector applies to a data file when the paths match, the data file&amp;#039;s sequence number is less than or equal to the vector&amp;#039;s, and the partitions are equal.&amp;lt;ref name=&amp;quot;icespec&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The Puffin blob wraps the bitmap with a length, the magic bytes &amp;lt;code&amp;gt;D1 D3 39 64&amp;lt;/code&amp;gt; and a CRC-32 checksum. The Puffin spec says its big-endian length and checksum fields were chosen for compatibility with existing deletion vectors in Delta tables.&amp;lt;ref name=&amp;quot;puffin&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Compaction and purge ==&lt;br /&gt;
A deletion vector hides rows but does not remove their bytes, so both projects provide ways to rewrite data files and drop the deleted rows physically.&lt;br /&gt;
&lt;br /&gt;
In Delta Lake, changes recorded in deletion vectors are applied when files are rewritten: by DML run with deletion vectors disabled, by &amp;lt;code&amp;gt;OPTIMIZE&amp;lt;/code&amp;gt;, or by &amp;lt;code&amp;gt;REORG TABLE ... APPLY (PURGE)&amp;lt;/code&amp;gt;. Only the last guarantees that every file with soft-deleted rows is rewritten. The old files remain until &amp;lt;code&amp;gt;VACUUM&amp;lt;/code&amp;gt; removes them.&amp;lt;ref name=&amp;quot;deltadoc&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In Iceberg, the spec requires that when a data file is removed, any deletion vector for it is removed from the delete manifests, though the Puffin file holding it need not be rewritten.&amp;lt;ref name=&amp;quot;icespec&amp;quot; /&amp;gt; The &amp;lt;code&amp;gt;rewrite_data_files&amp;lt;/code&amp;gt; procedure can select data files for rewriting by the number of deletes or the ratio of deleted rows, and the &amp;lt;code&amp;gt;removeDanglingDeleteFiles&amp;lt;/code&amp;gt; action drops deletion vectors whose data file is no longer live.&amp;lt;ref name=&amp;quot;iceproc&amp;quot;&amp;gt;{{Cite web |url=https://iceberg.apache.org/docs/latest/spark-procedures/ |title=Spark Procedures |publisher=Apache Iceberg |access-date=2026-11-22}}&amp;lt;/ref&amp;gt;&amp;lt;ref name=&amp;quot;icemaint&amp;quot;&amp;gt;{{Cite web |url=https://iceberg.apache.org/docs/latest/maintenance/ |title=Maintenance |publisher=Apache Iceberg |access-date=2026-11-22}}&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Not to be confused with ==&lt;br /&gt;
* &amp;#039;&amp;#039;&amp;#039;Position delete files&amp;#039;&amp;#039;&amp;#039; in Iceberg v2 also mark rows by position, but as rows in a separate data file that can reference many data files, rather than one bitmap per data file.&amp;lt;ref name=&amp;quot;icespec&amp;quot; /&amp;gt;&lt;br /&gt;
* &amp;#039;&amp;#039;&amp;#039;Merge-on-read log files&amp;#039;&amp;#039;&amp;#039; in [[Apache Hudi]] record updates and deletes for a file group in log files that compaction merges into a new base file; Hudi&amp;#039;s documentation describes them as log files, not deletion vectors.&amp;lt;ref name=&amp;quot;huditypes&amp;quot;&amp;gt;{{Cite web |url=https://hudi.apache.org/docs/table_types |title=Table &amp;amp; Query Types (version 1.2.1) |publisher=Apache Hudi |access-date=2026-11-22}}&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== See also ==&lt;br /&gt;
* [[Copy-on-write and merge-on-read]]&lt;br /&gt;
* [[Small files problem]]&lt;br /&gt;
* [[Delta Lake]]&lt;br /&gt;
* [[Apache Iceberg]]&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>