![]() ![]() ![]() This mode protects a table against concurrent data changes.Īcquired by CREATE INDEX (without CONCURRENTLY). SHARE ( ShareLock)Ĭonflicts with the ROW EXCLUSIVE, SHARE UPDATE EXCLUSIVE, SHARE ROW EXCLUSIVE, EXCLUSIVE, and ACCESS EXCLUSIVE lock modes. This mode protects a table against concurrent schema changes and VACUUM runs.Īcquired by VACUUM (without FULL), ANALYZE, CREATE INDEX CONCURRENTLY, CREATE STATISTICS, COMMENT ON, REINDEX CONCURRENTLY, and certain ALTER INDEX and ALTER TABLE variants (for full details see the documentation of these commands). ![]() SHARE UPDATE EXCLUSIVE ( ShareUpdateExclusiveLock)Ĭonflicts with the SHARE UPDATE EXCLUSIVE, SHARE, SHARE ROW EXCLUSIVE, EXCLUSIVE, and ACCESS EXCLUSIVE lock modes. In general, this lock mode will be acquired by any command that modifies data in a table. The commands UPDATE, DELETE, INSERT, and MERGE acquire this lock mode on the target table (in addition to ACCESS SHARE locks on any other referenced tables). ROW EXCLUSIVE ( RowExclusiveLock)Ĭonflicts with the SHARE, SHARE ROW EXCLUSIVE, EXCLUSIVE, and ACCESS EXCLUSIVE lock modes. The SELECT command acquires a lock of this mode on all tables on which one of the FOR UPDATE, FOR NO KEY UPDATE, FOR SHARE, or FOR KEY SHARE options is specified (in addition to ACCESS SHARE locks on any other tables that are referenced without any explicit FOR. ROW SHARE ( RowShareLock)Ĭonflicts with the EXCLUSIVE and ACCESS EXCLUSIVE lock modes. In general, any query that only reads a table and does not modify it will acquire this lock mode. The SELECT command acquires a lock of this mode on referenced tables. Table-Level Lock Modes ACCESS SHARE ( AccessShareLock)Ĭonflicts with the ACCESS EXCLUSIVE lock mode only. Notice in particular that some lock modes are self-conflicting (for example, an ACCESS EXCLUSIVE lock cannot be held by more than one transaction at a time) while others are not self-conflicting (for example, an ACCESS SHARE lock can be held by multiple transactions). For example, it might acquire ACCESS EXCLUSIVE lock and later acquire ACCESS SHARE lock on the same table.) Non-conflicting lock modes can be held concurrently by many transactions. (However, a transaction never conflicts with itself. Two transactions cannot hold locks of conflicting modes on the same table at the same time. The only real difference between one lock mode and another is the set of lock modes with which each conflicts (see Table 13.2). To some extent the names reflect the typical usage of each lock mode - but the semantics are all the same. Remember that all of these lock modes are table-level locks, even if the name contains the word “ row” the names of the lock modes are historical. You can also acquire any of these locks explicitly with the command LOCK. Of course all changes involve community discussion and patch review, so each item is truly a community effort.The list below shows the available lock modes and the contexts in which they are used automatically by PostgreSQL. The name appearing next to each item represents the major developer for that item. There is also a web interface that shows changes to specific files. The pgsql-committers email list records all source code changes as well. For example, the optimizer is improved in almost every release, but the improvements are usually observed by users as simply faster queries.Ī complete list of changes for each release can be obtained by viewing the Git logs for each release. The release notes do not contain changes that affect only a few users or changes that are internal and therefore not user-visible. The release notes contain the significant changes in each PostgreSQL release, with major features and migration issues listed at the top. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |