Locking

Lock partition

Also called: lock table partition, lock manager partition, NUM_LOCK_PARTITIONS

The shared lock table is divided into 16 partitions, each protected by its own lightweight lock and chosen by a hash of the lock tag. Splitting it this way means two backends locking different objects usually touch different partitions and don't contend with each other on the same internal lock.

What this means

The shared lock table is split into 16 sections, each guarded by its own internal lock and chosen by hashing the thing being locked. So two backends locking different objects usually land in different sections and never contend with each other over the same internal latch.

Why it matters operationally

Partitioning is what keeps the shared lock table scalable, but it only helps when locks spread across partitions. A workload that overflows the fast-path and funnels many locks into the shared table can still create partition-lock contention, which is why reducing the number of locked relations (partition pruning) matters.

Related & next

The lock fast-path explainedHeavyweight lock, the table being partitionedFast-path locking, how to avoid the partitions

← All glossary terms · GUC reference · Error catalog