The transaction IDs of currently executing transactions are shown in
pg_locks in columns
transactionid. Read-only transactions will have
virtualxids but NULL
transactionids, while both columns will be set in read-write transactions.
Some lock types wait on
virtualxid, while other types wait on
transactionid. Row-level read and write locks are recorded directly in the locked rows and can be inspected using the pgrowlocks extension. Row-level read locks might also require the assignment of multixact IDs (
mxid; see Section 18.104.22.168).
If you see anything in the documentation that is not correct, does not match your experience with the particular feature or requires further clarification, please use this form to report a documentation issue.