> [!NOTE] ModifyTable > <table> > <tr> > <td width="25%"><img src="assets/ex_modifytable.png"></td> > <td>The execution node responsible for performing <code>INSERT</code>, <code>UPDATE</code>, or <code>DELETE</code> operations. It handles the physical modification of tuples in the heap, manages index updates, and triggers Write-Ahead Log (WAL) insertions to ensure durability.</td> > </tr> > </table> > > ```sql > -- An UPDATE operation > EXPLAIN (ANALYZE, COSTS, BUFFERS, VERBOSE) > UPDATE animals SET name = 'Renamed' WHERE id = 1; > ``` > > ![ModifyTable Plan Tree](assets/plan_tree_op_modify_table.svg) > > ```text > Update on public.animals (cost=0.29..8.30 rows=0 width=0) (actual time=0.109..0.109 rows=0 loops=1) > Buffers: shared hit=24 > -> Index Scan using animals_pkey on public.animals (cost=0.29..8.30 rows=1 width=38) (actual time=0.005..0.005 rows=1 loops=1) > Output: 'Renamed'::text, ctid > Index Cond: (animals.id = 1) > Buffers: shared hit=3 > Planning: > Buffers: shared hit=77 > Planning Time: 0.181 ms > Execution Time: 0.153 ms > ``` > > ![ModifyTable measured plan performance signature](assets/trace_op_modify_table.svg) > > <table> > <tr> > <td rowspan="2" width="25%"><img src="assets/ex_update.svg"></td> > <td><b>Performance</b></td><td>High overhead due to physical I/O (WAL writing, index updates, and heap modification). Update and Delete are MVCC-compliant, meaning they mark old tuples as dead and (for Update) write new ones.</td> > </tr> > <tr><td><b>Cost</b></td><td><code>operation cost * number of rows</code></td></tr> > </table>