Glossary — in plain language

Lock


In plain English

A lock is a reservation that stops two sessions from changing the same thing at once. PostgreSQL takes many locks automatically — light ones for normal reads/writes, heavy ones for DDL like ALTER TABLE.

Why it matters

Most “the database is stuck” incidents are really lock contention: one slow transaction holds a lock and a queue forms behind it. Setting lock_timeout and watching pg_locks are key skills.

Was this helpful?

← Browse the full glossary