Virtual transactions
One bit that isn't really clear from the documentation is how the database internally handles assignment of transaction identification numbers, called transaction IDs or simply XIDs. And you can't easily decode the pg_locks information without knowing some trivia here.
Every statement in PostgreSQL executes within a transaction, either explicit or implied. If you want a transaction to span multiple statements, you put it into a transaction block using the BEGIN statement. Giving something an XID in PostgreSQL has some overhead. For example, each one of them is assigned its own space in the database commit logs, stored in the pg_xact directory.
As that involves several types of work including an eventual disk write; this ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access