Home > OS >  How many WAL logs are created on a large DELETE or BATCH statement?
How many WAL logs are created on a large DELETE or BATCH statement?

Time:07-01

Let's say I do a DELETE FROM table WHERE table.a = 5 and that accounts for 10 million records. Will that create 10M entries in the WAL or will that just be a single entry?

CodePudding user response:

WAL is a record of physical changes to the blocks of data on disk. So if your 10 million records are scattered across 2 million blocks that is how much WAL will be generated. In general you would want to also consider and index updates a query might cause. The vacuum process can also generate substantial WAL data.

CodePudding user response:

You will get one WAL record per row. The first time a page it modified after a checkpoint you will get a full page image (FPI) in the WAL, after that only the modified xmax value will be logged.

  • Related