Locking

LOCALLOCK

Also called: local lock table, per-backend lock cache

A LOCALLOCK is a backend's private record of the locks it currently holds and how many times it has acquired each. Before touching any shared memory, a backend checks this local table; if it already holds the requested lock, the request is satisfied locally with no shared-memory work at all.

What this means

A backend's own private tally of the locks it's holding and how many times it grabbed each. Before it ever reaches into shared memory, it checks this local list; if it already holds the lock being requested, the request is satisfied right there, with no shared-memory work at all.

Why it matters operationally

Re-acquiring an already-held lock is extremely common (nested function calls, repeated access to the same table), and LOCALLOCK makes that path nearly free. It is the first of three tiers, LOCALLOCK, then the fast-path, then the shared lock table, that keep normal locking cheap.

Related & next

The lock fast-path explainedFast-path locking, the next tierHeavyweight lock, the shared table behind it

← All glossary terms · GUC reference · Error catalog