Postgresql 中文操作指南
74.2. Transactions and Locking #
当前正在执行事务的事务 ID 会在 pg_locks 中的 virtualxid 和 transactionid 列中显示。只读事务将会有 _virtualxid_s,但 _transactionid_s 为 NULL,而读写事务会设置这两个列。
The transaction IDs of currently executing transactions are shown in pg_locks in columns virtualxid and transactionid. Read-only transactions will have _virtualxid_s but NULL _transactionid_s, while both columns will be set in read-write transactions.
一些锁类型等待 virtualxid,而其他类型等待 transactionid。行级别的读写锁会直接记录在已锁定的行中,并且可以使用 pgrowlocks 扩展进行检查。行级别读锁可能还需要分配多重事务 ID (mxid;请参阅 Section 25.1.5.1)。
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 25.1.5.1).