Multixacts

Multixacts are created when transactions use "SELECT … FOR UPDATE" (or one of these lock modes: SHARE, KEY SHARE, NO KEY UPDATE) to lock and update tuples.

Multixacts live in the pg_multixact direcory.

Examples

Show multixact usage:

SELECT relname, relminmxid, $NextMultiXactId-relminmxid::TEXT::BIGINT AS age
  FROM pg_class 
WHERE where relminmxid::TEXT::BIGINT <> 0 
ORDER BY relminmxid::TEXT::BIGINT ASC
 LIMIT 10;

where $NextMultiXactId is the value returned by SELECT next_multixact_id FROM pg_control_checkpoint() (for PostgreSQL 9.5 and earlier, the value contained in pg_controldata output for "Latest checkpoint's NextMultiXactId").

Categories

Locking, PostgreSQL internals, Transactions