Get the latest tech news

Exploring the enigma of database vacuuming


Before we discuss what VACUUM does and its implications, we need to understand how data is actually stored on disk. What happens when a tuple is inserted, updated, or deleted? Understanding this will help us understand what VACUUM does, why it’s needed, and its implications.

Performing a plain vacuum operation on a database table does not always require an exclusive lock, except during the Heap Truncating phase. The primary node can monitor ongoing Data Manipulation Language (DML) operations on the table and release the lock if needed. If you have a running job that might update or delete a large number of rows, it is better to disable the TRUNCATE option in the VACUUM operation so that the ACCESS EXCLUSIVE is not acquired, which might impact the production traffic.

Get the Android app

Or read this on Hacker News

Read more on:

Photo of database

database

Photo of Enigma

Enigma

Photo of vacuuming

vacuuming

Related news:

News photo

We were wrong, we need a database

News photo

Automate your vacuuming and mopping with $400 off the Roomba Combo J9+

News photo

The 6502 instruction set as a database