Loading topic
psql in two sessions. It covers where PostgreSQL stores row versions and how it links them. The chapters that follow cover how transaction IDs and snapshots decide which version a query sees.6 min readxmin and xmax values. This chapter explains what those numbers are, when PostgreSQL hands them out, and why they behave the way they do. It assumes you can run psql with two sessions and that you have seen xmin, xmax and ctid on the 6 min readpsql sessions on the same database. Here you learn to read the three system columns that tie these ideas together, and to avoid the misreadings they invite.4 min readpsql in two sessions and know what a transaction is. It also assumes you have met the hidden columns xmin, xmax and ctid, which the previous chapter introduced. Here you will see how each write statement creates or marks row versions, and why none of them edi6 min readxmin and an xmax. Those fields name transactions, but they don't say whether each transaction committed. Visibility checks need that answer. This chapter covers where PostgreSQL stores it, how it avoids looking it up on every read, and wh6 min readxmin and xmax columns. This chapter assumes you know those, and that you can open two psql sessions against one da5 min readxmin/xmax, transaction IDs, commit status and snapshots. You also need two psql sessions open against the same database.5 min readpsql, open two sessions against one database, and use BEGIN, COMMIT and ROLLBACK. It also assumes you know what a snapshot is and what xmin and xmax mean on a row version. Here you will see that PostgreSQL's isolation levels differ mainly in one thing: wh6 min readxmin/xmax, snapshots, and isolation levels as snapshot timing. It also assumes you can open two psql sessions against the same database. Readers never block writers under MVCC, but two writers that touch the same row stil6 min readxmin/xmax). It also assumes you can run psql and open two sessions. Here you will see why those old versions pile up, how VACUUM reclaims thei5 min readxmin, xmax and ctid identify versions, and what VACUUM reclaims. You also need two psql sessions and a superuser role for the pageinspect extension.5 min readEXPLAIN output. Here we look at the small data structure that lets PostgreSQL skip visibility checks, and at the query plans6 min readxmin and xmax are, how a snapshot decides visibility, and what VACUUM does with dead tuples. It explains why PostgreSQL must also rewrite old, still-live rows, which is called freezing, and how to watch for the problem it prevents.6 min readxmin and xmax decide which row versions that snapshot can see. You also need two psql s5 min read