For page 6 of the Vacuuming Postgres Databases section (261-6), there is the following sentence:
“We see that the value of xmin
is 730
meaning that rows with transaction ID 730
or less cannot yet be deleted from the table.”
I believe that this sentence is incorrect. In 261-5 xmin and xmax are defined:
“By looking in the documentation, we see that Postgres keeps two values named xmin
and xmax
to be able to determine if a row can safely be removed. The xmin
value represents the transaction ID of the transaction that inserted the row. In the same way, the xmax
column represents the transaction ID of the transaction that deleted the row.”
Shouldn’t the vacuum procedure involve checking whether there are any transactions running that are older than xmax (not xmin)? I did some googling and the following source agrees with me:
Link.
“Now, here comes VACUUM. When vacuum runs, and it sees deleted row (one that has xmax that is not 0), it (vacuum) checks if there are any transactions running that are older than the xmax (so they should still see the row). If there are, nothing is done as the row might still be needed.”