<?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=Copy-on-write_and_merge-on-read</id>
	<title>Copy-on-write and merge-on-read - Revision history</title>
	<link rel="self" type="application/atom+xml" href="https://openlakehouse.io/w/index.php?action=history&amp;feed=atom&amp;title=Copy-on-write_and_merge-on-read"/>
	<link rel="alternate" type="text/html" href="https://openlakehouse.io/w/index.php?title=Copy-on-write_and_merge-on-read&amp;action=history"/>
	<updated>2026-12-06T00:08:38Z</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=Copy-on-write_and_merge-on-read&amp;diff=63&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=Copy-on-write_and_merge-on-read&amp;diff=63&amp;oldid=prev"/>
		<updated>2026-11-22T21:29:52Z</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            = Copy-on-write and merge-on-read&lt;br /&gt;
| also_known_as   = CoW and MoR; write modes for row-level operations&lt;br /&gt;
| field           = Table formats&lt;br /&gt;
| key_parts       = Rewritten data files (copy-on-write); delete files, deletion vectors or log files merged at read time (merge-on-read)&lt;br /&gt;
| implementations = [[Apache Iceberg]], [[Delta Lake]], [[Apache Hudi]]&lt;br /&gt;
| related         = [[Deletion vector]], [[Small files problem]], [[Open table format]]&lt;br /&gt;
}}&lt;br /&gt;
{{Verified|2026-11-22|the Apache Iceberg table spec and configuration documentation (1.12.0), the Delta Lake deletion vectors documentation and PROTOCOL.md at v4.4.1, and the Apache Hudi table types documentation (version 1.2.1)}}&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;Copy-on-write&amp;#039;&amp;#039;&amp;#039; and &amp;#039;&amp;#039;&amp;#039;merge-on-read&amp;#039;&amp;#039;&amp;#039; are the two strategies an [[open table format]] can use to apply row-level updates and deletes to data stored in immutable files. With copy-on-write, the writer rewrites every data file that contains a changed row, so readers only read data files. With merge-on-read, the writer records the change separately (as delete files, [[Deletion vector|deletion vectors]] or log files) and readers combine those records with the original data files at query time.&amp;lt;ref name=&amp;quot;hudi-types&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; The choice moves cost between writes and reads. [[Apache Iceberg]], [[Delta Lake]] and [[Apache Hudi]] all support both approaches, with different names and defaults.&lt;br /&gt;
&lt;br /&gt;
== Why the choice exists ==&lt;br /&gt;
Lakehouse data files, usually [[Apache Parquet]], are written once and never changed in place. The Iceberg specification requires that files are not moved or altered once they are written, and states that data and metadata files are immutable until they are deleted.&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; A &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; that touches one row must therefore either produce a new copy of the file without that row, or leave the file alone and write a note saying the row is gone.&lt;br /&gt;
&lt;br /&gt;
The Delta Lake documentation states the copy-on-write cost directly: by default, deleting a single row means rewriting the entire Parquet file that contains it.&amp;lt;ref name=&amp;quot;delta-dv&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;
== Copy-on-write ==&lt;br /&gt;
In copy-on-write, a row-level operation reads each affected data file, writes a new file with the changes applied, and commits a snapshot that replaces the old file with the new one. Readers see only complete data files and do no merging. The cost is write amplification: the whole file is rewritten even when a small fraction of its rows changed.&amp;lt;ref name=&amp;quot;hudi-types&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Iceberg&amp;#039;s Spark integration reports this cost as a metric: &amp;lt;code&amp;gt;spark.delete.num-copied-rows&amp;lt;/code&amp;gt; counts unmodified rows that were rewritten in copy-on-write mode and is zero in merge-on-read.&amp;lt;ref name=&amp;quot;ice-writes&amp;quot;&amp;gt;{{Cite web |url=https://iceberg.apache.org/docs/latest/spark-writes/ |title=Spark Writes |publisher=Apache Iceberg |access-date=2026-11-22}}&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Merge-on-read ==&lt;br /&gt;
In merge-on-read, the writer adds a small record of the change and leaves existing data files untouched. Each project encodes the record differently:&lt;br /&gt;
&lt;br /&gt;
* &amp;#039;&amp;#039;&amp;#039;Apache Iceberg&amp;#039;&amp;#039;&amp;#039; (format version 2 and later) writes delete files. Position deletes mark a row by data file and row position; equality deletes mark rows by column values, such as &amp;lt;code&amp;gt;id = 5&amp;lt;/code&amp;gt;. In format version 3, position deletes are stored as deletion vectors in Puffin files, and position delete files are deprecated.&amp;lt;ref name=&amp;quot;icespec&amp;quot; /&amp;gt;&lt;br /&gt;
* &amp;#039;&amp;#039;&amp;#039;Delta Lake&amp;#039;&amp;#039;&amp;#039; attaches a deletion vector to the data file&amp;#039;s entry in the transaction log, marking rows as logically deleted while they stay physically in the file. Readers must skip those rows.&amp;lt;ref name=&amp;quot;delta-proto&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;&lt;br /&gt;
* &amp;#039;&amp;#039;&amp;#039;Apache Hudi&amp;#039;&amp;#039;&amp;#039; merge-on-read tables write updates and deletes to log files next to a columnar base file, and a periodic compaction merges the log files into a new base file. Queries on such tables can be snapshot queries, which merge the logs for the freshest data, or read-optimized queries, which read only the compacted base files.&amp;lt;ref name=&amp;quot;hudi-types&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Merge-on-read makes writes cheaper but adds work to every read until the changes are compacted into rewritten data files. Hudi&amp;#039;s documentation notes that merge-on-read query performance depends on whether the log files have been compacted.&amp;lt;ref name=&amp;quot;hudi-types&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Comparison ==&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! !! [[Apache Iceberg]] !! [[Delta Lake]] !! [[Apache Hudi]]&lt;br /&gt;
|-&lt;br /&gt;
| How the strategy is chosen || Per operation, with table properties &amp;lt;code&amp;gt;write.delete.mode&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;write.update.mode&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;write.merge.mode&amp;lt;/code&amp;gt;&amp;lt;ref name=&amp;quot;ice-conf&amp;quot;&amp;gt;{{Cite web |url=https://iceberg.apache.org/docs/latest/configuration/ |title=Configuration |publisher=Apache Iceberg |access-date=2026-11-22}}&amp;lt;/ref&amp;gt; || Table property &amp;lt;code&amp;gt;delta.enableDeletionVectors&amp;lt;/code&amp;gt;&amp;lt;ref name=&amp;quot;delta-dv&amp;quot; /&amp;gt; || Table type, fixed when the table is created: &amp;lt;code&amp;gt;hoodie.datasource.write.table.type&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;hoodie.table.type&amp;lt;/code&amp;gt;, values &amp;lt;code&amp;gt;COPY_ON_WRITE&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;MERGE_ON_READ&amp;lt;/code&amp;gt;&amp;lt;ref name=&amp;quot;hudi-conf&amp;quot;&amp;gt;{{Cite web |url=https://hudi.apache.org/docs/configurations |title=All Configurations |publisher=Apache Hudi |access-date=2026-11-22}}&amp;lt;/ref&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| Default || &amp;lt;code&amp;gt;copy-on-write&amp;lt;/code&amp;gt; for all three properties&amp;lt;ref name=&amp;quot;ice-conf&amp;quot; /&amp;gt; || Files are rewritten unless deletion vectors are enabled on the table&amp;lt;ref name=&amp;quot;delta-dv&amp;quot; /&amp;gt; || &amp;lt;code&amp;gt;COPY_ON_WRITE&amp;lt;/code&amp;gt;&amp;lt;ref name=&amp;quot;hudi-conf&amp;quot; /&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| Merge-on-read record || Position delete files (v2), equality delete files, deletion vectors (v3)&amp;lt;ref name=&amp;quot;icespec&amp;quot; /&amp;gt; || Deletion vectors stored in files or inline in the log&amp;lt;ref name=&amp;quot;delta-proto&amp;quot; /&amp;gt; || Log files attached to a base file&amp;lt;ref name=&amp;quot;hudi-types&amp;quot; /&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| Requirements || Merge-on-read requires format version 2 or later&amp;lt;ref name=&amp;quot;ice-conf&amp;quot; /&amp;gt; || Reader version 3 and writer version 7 with the &amp;lt;code&amp;gt;deletionVectors&amp;lt;/code&amp;gt; table feature&amp;lt;ref name=&amp;quot;delta-proto&amp;quot; /&amp;gt; || The table type cannot change between writes&amp;lt;ref name=&amp;quot;hudi-conf&amp;quot; /&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| Folding changes back into data files || Data file compaction with &amp;lt;code&amp;gt;rewrite_data_files&amp;lt;/code&amp;gt;, which can select files by delete count or delete ratio&amp;lt;ref name=&amp;quot;ice-proc&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;code&amp;gt;OPTIMIZE&amp;lt;/code&amp;gt;, DML with deletion vectors disabled, or &amp;lt;code&amp;gt;REORG TABLE ... APPLY (PURGE)&amp;lt;/code&amp;gt;&amp;lt;ref name=&amp;quot;delta-dv&amp;quot; /&amp;gt; || Compaction of merge-on-read file groups&amp;lt;ref name=&amp;quot;hudi-types&amp;quot; /&amp;gt;&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== Example ==&lt;br /&gt;
In Iceberg the mode is a table property, so one table can use merge-on-read for deletes and copy-on-write for merges.&amp;lt;ref name=&amp;quot;ice-conf&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;sql&amp;quot;&amp;gt;&lt;br /&gt;
-- Apache Iceberg (Spark SQL): merge-on-read for DELETE and UPDATE, copy-on-write for MERGE&lt;br /&gt;
ALTER TABLE db.events SET TBLPROPERTIES (&lt;br /&gt;
  &amp;#039;write.delete.mode&amp;#039; = &amp;#039;merge-on-read&amp;#039;,&lt;br /&gt;
  &amp;#039;write.update.mode&amp;#039; = &amp;#039;merge-on-read&amp;#039;,&lt;br /&gt;
  &amp;#039;write.merge.mode&amp;#039;  = &amp;#039;copy-on-write&amp;#039;&lt;br /&gt;
);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The Delta Lake equivalent enables deletion vectors on the table: &amp;lt;code&amp;gt;ALTER TABLE t SET TBLPROPERTIES (&amp;#039;delta.enableDeletionVectors&amp;#039; = true)&amp;lt;/code&amp;gt;. Doing so upgrades the table protocol, and clients that do not support deletion vectors can no longer read the table.&amp;lt;ref name=&amp;quot;delta-dv&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Choosing a strategy ==&lt;br /&gt;
The projects document the tradeoff in general terms rather than with a fixed rule.&lt;br /&gt;
&lt;br /&gt;
Apache Hudi gives the most explicit guidance. Its documentation describes copy-on-write as suited to read-heavy workloads, batch ETL, data warehousing on data lakes and slowly changing reference data, and merge-on-read as suited to change data capture pipelines, streaming ingestion, hybrid batch and streaming workloads, and tables with frequent updates and deletes. Its comparison lists copy-on-write as having higher write latency and update cost and lower query latency, and merge-on-read the reverse.&amp;lt;ref name=&amp;quot;hudi-types&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Delta Lake describes deletion vectors as a storage optimization that avoids rewriting Parquet files for some operations, with reads applying the recorded deletions. Its documentation adds that &amp;lt;code&amp;gt;UPDATE&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;MERGE&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;OPTIMIZE&amp;lt;/code&amp;gt; do not guarantee that all recorded deletions get applied, so &amp;lt;code&amp;gt;REORG TABLE ... APPLY (PURGE)&amp;lt;/code&amp;gt; is the command that rewrites every affected file.&amp;lt;ref name=&amp;quot;delta-dv&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Apache Iceberg documents the properties and their defaults, and documents compaction as the way to rewrite files with many deletes, but its configuration page does not recommend one mode over the other.&amp;lt;ref name=&amp;quot;ice-conf&amp;quot; /&amp;gt;&amp;lt;ref name=&amp;quot;ice-proc&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== See also ==&lt;br /&gt;
* [[Deletion vector]]&lt;br /&gt;
* [[Small files problem]]&lt;br /&gt;
* [[Open table format]]&lt;br /&gt;
* [[Apache Iceberg]]&lt;br /&gt;
* [[Delta Lake]]&lt;br /&gt;
* [[Apache Hudi]]&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>