简体   繁体   中英

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

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?

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.

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM