Scrivio Interview library
ConceptIntermediate7 min read · updated 12 November 2026

What is write amplification in a database? Name the main sources of extra writes in PostgreSQL and InnoDB when one row is updated, and explain how HOT updates reduce them in PostgreSQL.

Write amplification is the ratio of bytes written to storage to the bytes of logical change, and for a small update it can be hundreds to one. In PostgreSQL one update writes a new row version in the heap, a WAL record, a full 8 KB page image in the WAL the first time a page changes after a checkpoint, and, unless it is a HOT update, a new entry in every index; InnoDB writes redo, undo, pages through the doublewrite buffer and changed index pages. A HOT (heap-only tuple) update avoids the index writes when no indexed column changes and the new version fits on the same page, which lower fillfactor, fewer indexes and not updating indexed columns make more likely.

Why this question is asked

Write amplification is why a table with modest traffic can produce terabytes of WAL, saturate replicas and inflate backups. Interviewers ask about it to check that we can account for every byte an update really costs and that we know the levers, HOT updates above all in PostgreSQL. In this answer, we will define the ratio, follow one small update through PostgreSQL and add up its writes, do the same for InnoDB, look at how HOT updates work, and finish with how to make them happen more often.

1What Write Amplification Means

Suppose we change a shipment's status from 'PACKED' to 'SHIPPED'. Logically about ten bytes changed. But the database writes far more than ten bytes: it must keep the change durable, keep indexes consistent, protect pages from partial writes and eventually write whole pages back to the data files. Write amplification is bytes physically written divided by bytes logically changed. It matters because storage bandwidth, WAL shipping to replicas, backup size and SSD wear all scale with the physical bytes, not the logical ones.

2Following One Update in PostgreSQL

PostgreSQL's MVCC never overwrites a row. The update writes a new row version, a tuple of perhaps 150 bytes, somewhere in the heap, and marks the old one as expired. Every change to a page is described in the WAL, the write-ahead log, so the new tuple and the change to the old one produce a WAL record of a few hundred bytes.

Then comes the large item. With full_page_writes on, the default, the first time a page is modified after a checkpoint, PostgreSQL writes the entire 8 KB page into the WAL, a full-page image, so that a page torn by a crash in the middle of a write can be restored. Finally, if the update is not HOT, each index on the table receives a new entry pointing to the new version, and each of those index page changes needs its own WAL record and possibly its own full-page image. Later, the checkpointer writes every dirty heap and index page back to the data files, 8 KB each.

Java
-- One status update on a table with 5 indexes, first change of these pages since the checkpoint
heap: new tuple ~ 150 B (later the 8 KB heap page is written back)
WAL: heap record + full-page image ~ 8.4 KB
WAL: 5 index inserts, each with a page image ~ 5 x 8.2 KB = 41 KB
data files later: 1 heap + 5 index pages = 6 x 8 KB = 48 KB
total ~ 98 KB for ~10 bytes of logical change -> amplification in the thousands, worst case
Where an update's writes go
SourcePostgreSQLInnoDB
durability logWAL recordredo log record
torn page protectionfull-page image in WAL after checkpointdoublewrite buffer: pages written twice
old versionstays in heap until vacuumundo log (itself protected by redo)
indexesnew entry in every index unless HOTchanged clustered and secondary pages
page write-backcheckpointer and background writerpage cleaner threads

Notice that most of the cost is full-page images and index maintenance, not the change itself. Later updates of the same pages before the next checkpoint are much cheaper, because the page images were already written, and many updates to one page share the final page write. Real ratios are therefore lower on average, but still high.

3The Same Update in InnoDB

InnoDB updates the row in place in the clustered index page and stores the old version in the undo log, which serves rollbacks and consistent reads; the undo changes are themselves protected by redo. Every change is recorded in the redo log, which is flushed at commit. Secondary indexes change only if their columns change, since they point by primary key and not by physical location, which is an advantage over PostgreSQL's design for updates of non-indexed columns.

InnoDB protects against torn pages differently: when it flushes a dirty page, it first writes it to the doublewrite buffer area and only then to its real place, so every page write happens twice. Its redo records do not include full-page images, but the doublewrite buffer plays the same role in a different place.

4How HOT Updates Help

A HOT update, short for heap-only tuple, is PostgreSQL's way to skip index maintenance. It is possible when two conditions hold: no column used by any index changes, and the new row version fits on the same heap page as the old one. Then PostgreSQL writes the new version on the same page and links the old version to it inside the page. Indexes keep pointing at the old location, and a lookup follows the short chain within the page to the current version. No index entry is added, so no index pages, WAL for them or page images are needed.

HOT also makes cleanup cheaper: old versions in a HOT chain can be pruned during normal page access, without waiting for vacuum.

Step throughCan this update be HOT?
  1. Does it change any indexed column?including columns used in partial index predicates
    YesNormal update: new entry in every indexNoNext check
  2. Is there free space on the same heap page?fillfactor leaves room
    YesHOT update: same page, no index writesNoNormal update on another page

2 steps in order. Play them, or step through them one at a time.

5Making More Updates HOT

Three levers increase the share of HOT updates. First, leave space on each page by lowering the table's fillfactor, for example to 85 or 90, so a new version has somewhere to go. Second, keep indexes off columns that change constantly; an index on updated_at turns every update into a non-HOT one. Third, drop indexes nobody uses, because each one is a column set that can block HOT and another index to maintain. Since PostgreSQL 16, columns that are indexed only by BRIN indexes do not block HOT (check your version), which makes BRIN a useful choice for timestamps on large tables.

SQL
ALTER TABLE shipment SET (fillfactor = 85);
SELECT relname, n_tup_upd, n_tup_hot_upd,
round(100.0 * n_tup_hot_upd / nullif(n_tup_upd, 0), 1) AS hot_pct
FROM pg_stat_user_tables WHERE relname = 'shipment'; -- shipment | 9120400 | 912040 | 10.0

A HOT percentage of 10, as in this example, tells us that nine in ten updates write into every index. After removing an index on a constantly changing column and lowering fillfactor, it is common to see this rise above 90 percent, and WAL volume fall sharply.

6Follow-up questions

How can you see the share of HOT updates for a table?

pg_stat_user_tables has n_tup_upd, the number of updated rows, and n_tup_hot_upd, the number of those that were HOT; dividing them gives the HOT ratio. Since PostgreSQL 16 there is also n_tup_newpage_upd, which counts updates whose new version went to a different page, a sign that fillfactor is too high. We compare the counters over an interval rather than since the last reset.

Does lowering fillfactor have a cost?

Yes. Pages start partly empty, so the table takes more space and a full scan reads more pages: at fillfactor 80, about 25 percent more. It pays off for frequently updated tables and is wasteful for append-only ones.

Why does an SSD care about write amplification?

SSDs wear out after a limited number of writes, and their own firmware adds another layer of amplification. Database amplification multiplies with it, so a write-heavy database can exhaust drive endurance much faster than the logical write rate suggests.

7Conclusion

In this answer, we saw that write amplification is physical bytes written per logical byte changed, and that a small update in PostgreSQL writes a new heap version, a WAL record, full-page images after each checkpoint and a new entry in every index unless the update is HOT, plus later page write-backs. InnoDB pays with redo, undo, the doublewrite buffer and changed index pages. HOT updates skip index writes when no indexed column changes and the page has room, and lower fillfactor, fewer indexes and not indexing constantly changing columns make them more frequent.

What to say in the interviewAbout 90 seconds aloud

Open with

Write amplification is the ratio between what the database physically writes and the logical change. Changing a ten-byte status can cost tens of kilobytes. In PostgreSQL, an update writes a whole new row version in the heap because of MVCC, plus a WAL record.

Then, if they want more

If it is the first change to that page since the last checkpoint, full_page_writes puts the entire 8 KB page into the WAL to protect against torn pages. And unless the update is HOT, every index on the table gets a new entry pointing to the new version, each with its own WAL and possibly its own page image.

Later the checkpointer writes all those dirty pages back. InnoDB updates in place but writes the redo log, the undo log for the old version, writes each flushed page twice through the doublewrite buffer, and changes index pages whose columns changed.

HOT, heap-only tuple, updates are PostgreSQL's big lever: if no indexed column changes and there is free space on the same page, the new version goes on that page, linked from the old one, and no index is touched at all.

So I lower fillfactor to 85 or 90 on hot tables, avoid indexes on constantly changing columns like updated_at, drop unused indexes, and check the ratio of n_tup_hot_upd to n_tup_upd in pg_stat_user_tables. Since PostgreSQL 16, BRIN-only columns do not block HOT either.

About this answer

Last updated
12 November 2026
Versions it names
PostgreSQL 16
Checked
Its structure and format are checked automatically. Use it as a carefully prepared study note: where a detail matters, confirm it against the documentation below. What the checks cover
Where the question comes from
Written by Scrivio for practice. It is not taken from an interview.
Report an issue with this answer

Copy the line below and send it to the author with what you found. It carries the address of this page.

Issue with "What is write amplification in a database? Name the main sources of extra writes in...": https://scrivio-interview-library.netlify.app/databases/storage-internals/a7a1f15cc2/