Types of Locks
Yellowbrick provides various lock modes to control concurrent access to data in tables. The list of Table Level Locks is given below:
Table Level Locks
Access Share (AccessShareLock
)
The SELECT
command acquires a lock of this mode on referenced tables. In general, any query that only reads a table and does not modify it will acquire this lock mode.
Share Update Exclusive (ShareUpdateExclusiveLock
)
Acquired by VACUUM
(without FULL
), ANALYZE
,UPDATE
and ALTER TABLE
variants. This mode protects a table against concurrent schema changes and VACUUM
runs.
Access Exclusive (AccessExclusiveLock
)
Acquired by the DROP TABLE
, TRUNCATE
. ALTER TABLE
also acquire a lock at this level. This mode guarantees that the holder is the only transaction accessing the table in any way.
Row Exclusive (RowExclusiveLock
)
The commands UPDATE
, DELETE
and INSERT
acquire this lock mode on the target table. In general, this lock mode will be acquired by any command that modifies data in a table.