Posts

Showing posts with the label explicit locking

Table-level Locks

Image
Introduction Lock Modes As mentioned in the previous article, the lock management system is divided into three main levels depending on the locked object: Table-level Locks , Row-level Locks and Page-level Locks . For each lock level, it is further divided into multiple lock modes, for instance, Table-level Locks has eight different lock modes. These lock modes are specific implementations derived from two primary lock types, which are Shared Lock and Exclusive Lock . When a statement executes, Postgres automatically assigns the appropriate lock type, so we rarely need to manually execute lock commands. Understanding these lock modes helps you know which SQL statements can run concurrently and which statements will force others to queue and wait. Below are the details of the eight Table-level Lock Modes in Postgres, ordered from the lowest level (least conflict) to the highest level (blocking everything). Access Share (AS) Activation command: SELECT (pure, without any locking clause...