Calculating WAL Generation for DML Operations in PostgreSQL
PostgreSQL provides the EXPLAIN command with the ANALYZE and WAL options to measure the WAL generated by a DML operation. This feature helps database administrators investigate the impact of INSERT, UPDATE, and DELETE statements on WAL generation. In this article, we use EXPLAIN (ANALYZE, WAL) to measure the WAL generated when updating 10 million rows, compare the results with and without an index, and investigate the effect of enabling WAL compression. 1. Test environment The test uses a person table containing 10 million rows . The table occupies approximately 880 MB , and WAL compression is initially disabled. vahiddb = # \dt + List of tables Schema | Name | Type | Owner | Persistence | Access method | Size | Description --------+--------+-------+----------+-------------+---------------+--------+------------- public | person | table | postgres | permanent | heap | 880 MB | ( 1 row ) vahiddb = # show w...