{"Entry":{"collection":"catalog","key":"pg_locks","name":"pg_locks","aliases":[],"metadata":{"changed_in":["8.1","8.3","9.2","14"],"changes":[{"added":["locktype","page","tuple","transactionid","classid","objid","objsubid"],"attributes":[],"description_changed":true,"descriptions":[{"from":"OID of the database in which the locked relation exists, or zero if the locked relation is a globally-shared table, or NULL if the lockable object is a transaction ID","name":"database","to":"OID of the database in which the object exists, or zero if the object is a shared object, or NULL if the object is a transaction ID"},{"from":"process ID of a server process holding or awaiting this lock","name":"pid","to":"Process ID of the server process holding or awaiting this lock. Null if the lock is held by a prepared transaction."},{"from":"OID of the locked relation, or NULL if the lockable object is a transaction ID","name":"relation","to":"OID of the relation, or NULL if the object is not a relation or part of a relation"},{"from":"ID of a transaction, or NULL if the lockable object is a relation","name":"transaction","to":"ID of the transaction that is holding or awaiting this lock."}],"from":"8.0","listing":[],"order":true,"removed":[],"status":"changed","to":"8.1","types":[],"unlisted":[]},{"added":[],"attributes":[],"description_changed":false,"descriptions":[{"from":"true if lock is held, false if lock is awaited","name":"granted","to":"True if lock is held, false if lock is awaited"},{"from":"type of the lockable object: relation, extend, page, tuple, transactionid, object, or userlock","name":"locktype","to":"type of the lockable object: relation, extend, page, tuple, transactionid, object, userlock, or advisory"},{"from":"name of the lock mode held or desired by this process (see Section 12.3.1)","name":"mode","to":"Name of the lock mode held or desired by this process (see Section 12.3.1)"},{"from":"page number within the relation, or NULL if the object is not a tuple or relation page","name":"page","to":"Page number within the relation, or NULL if the object is not a tuple or relation page"},{"from":"Process ID of the server process holding or awaiting this lock. Null if the lock is held by a prepared transaction.","name":"pid","to":"Process ID of the server process holding or awaiting this lock. NULL if the lock is held by a prepared transaction"},{"from":"ID of the transaction that is holding or awaiting this lock.","name":"transaction","to":"ID of the transaction that is holding or awaiting this lock"},{"from":"tuple number within the page, or NULL if the object is not a tuple","name":"tuple","to":"Tuple number within the page, or NULL if the object is not a tuple"}],"from":"8.1","listing":[],"order":false,"removed":[],"status":"reworded","to":"8.2","types":[],"unlisted":[]},{"added":["virtualxid","virtualtransaction"],"attributes":[],"description_changed":true,"descriptions":[{"from":"type of the lockable object: relation, extend, page, tuple, transactionid, object, userlock, or advisory","name":"locktype","to":"type of the lockable object: relation, extend, page, tuple, transactionid, virtualxid, object, userlock, or advisory"},{"from":"Name of the lock mode held or desired by this process (see Section 12.3.1)","name":"mode","to":"Name of the lock mode held or desired by this process (see Section 13.3.1)"}],"from":"8.2","listing":[],"order":false,"removed":["transaction"],"status":"changed","to":"8.3","types":[],"unlisted":[]},{"added":[],"attributes":[],"description_changed":false,"descriptions":[{"from":"OID of the system catalog containing the object, or NULL if the object is not a general database object","name":"classid","to":"OID of the system catalog containing the object, or null if the object is not a general database object"},{"from":"OID of the database in which the object exists, or zero if the object is a shared object, or NULL if the object is a transaction ID","name":"database","to":"OID of the database in which the object exists, or zero if the object is a shared object, or null if the object is a transaction ID"},{"from":"type of the lockable object: relation, extend, page, tuple, transactionid, virtualxid, object, userlock, or advisory","name":"locktype","to":"Type of the lockable object: relation, extend, page, tuple, transactionid, virtualxid, object, userlock, or advisory"},{"from":"OID of the object within its system catalog, or NULL if the object is not a general database object","name":"objid","to":"OID of the object within its system catalog, or null if the object is not a general database object"},{"from":"For a table column, this is the column number (the classid and objid refer to the table itself). For all other object types, this column is zero. NULL if the object is not a general database object","name":"objsubid","to":"For a table column, this is the column number (the classid and objid refer to the table itself). For all other object types, this column is zero. Null if the object is not a general database object"},{"from":"Page number within the relation, or NULL if the object is not a tuple or relation page","name":"page","to":"Page number within the relation, or null if the object is not a tuple or relation page"},{"from":"Process ID of the server process holding or awaiting this lock. NULL if the lock is held by a prepared transaction","name":"pid","to":"Process ID of the server process holding or awaiting this lock. Null if the lock is held by a prepared transaction."},{"from":"OID of the relation, or NULL if the object is not a relation or part of a relation","name":"relation","to":"OID of the relation, or null if the object is not a relation or part of a relation"},{"from":"ID of a transaction, or NULL if the object is not a transaction ID","name":"transactionid","to":"ID of a transaction, or null if the object is not a transaction ID"},{"from":"Tuple number within the page, or NULL if the object is not a tuple","name":"tuple","to":"Tuple number within the page, or null if the object is not a tuple"},{"from":"Virtual ID of a transaction, or NULL if the object is not a virtual transaction ID","name":"virtualxid","to":"Virtual ID of a transaction, or null if the object is not a virtual transaction ID"}],"from":"8.4","listing":[],"order":false,"removed":[],"status":"reworded","to":"9.0","types":[],"unlisted":[]},{"added":[],"attributes":[],"description_changed":true,"descriptions":[{"from":"Name of the lock mode held or desired by this process (see Section 13.3.1)","name":"mode","to":"Name of the lock mode held or desired by this process (see Section 13.3.1 and Section 13.2.3)"},{"from":"For a table column, this is the column number (the classid and objid refer to the table itself). For all other object types, this column is zero. Null if the object is not a general database object","name":"objsubid","to":"Column number targeted by the lock (the classid and objid refer to the table itself), or zero if the target is some other general database object, or null if the target is not a general database object"},{"from":"Process ID of the server process holding or awaiting this lock. Null if the lock is held by a prepared transaction.","name":"pid","to":"Process ID of the server process holding or awaiting this lock, or null if the lock is held by a prepared transaction"}],"from":"9.0","listing":[],"order":false,"removed":[],"status":"reworded","to":"9.1","types":[],"unlisted":[]},{"added":["fastpath"],"attributes":[],"description_changed":false,"descriptions":[{"from":"OID of the system catalog containing the object, or null if the object is not a general database object","name":"classid","to":"OID of the system catalog containing the lock target, or null if the target is not a general database object"},{"from":"OID of the database in which the object exists, or zero if the object is a shared object, or null if the object is a transaction ID","name":"database","to":"OID of the database in which the lock target exists, or zero if the target is a shared object, or null if the target is a transaction ID"},{"from":"OID of the object within its system catalog, or null if the object is not a general database object","name":"objid","to":"OID of the lock target within its system catalog, or null if the target is not a general database object"},{"from":"Page number within the relation, or null if the object is not a tuple or relation page","name":"page","to":"Page number targeted by the lock within the relation, or null if the target is not a relation page or tuple"},{"from":"OID of the relation, or null if the object is not a relation or part of a relation","name":"relation","to":"OID of the relation targeted by the lock, or null if the target is not a relation or part of a relation"},{"from":"ID of a transaction, or null if the object is not a transaction ID","name":"transactionid","to":"ID of the transaction targeted by the lock, or null if the target is not a transaction ID"},{"from":"Tuple number within the page, or null if the object is not a tuple","name":"tuple","to":"Tuple number targeted by the lock within the page, or null if the target is not a tuple"},{"from":"Virtual ID of a transaction, or null if the object is not a virtual transaction ID","name":"virtualxid","to":"Virtual ID of the transaction targeted by the lock, or null if the target is not a virtual transaction ID"}],"from":"9.1","listing":[],"order":false,"removed":[],"status":"changed","to":"9.2","types":[],"unlisted":[]},{"added":[],"attributes":[],"description_changed":true,"descriptions":[{"from":"Type of the lockable object: relation, extend, page, tuple, transactionid, virtualxid, object, userlock, or advisory","name":"locktype","to":"Type of the lockable object: relation, extend, frozenid, page, tuple, transactionid, virtualxid, object, userlock, or advisory"}],"from":"9.4","listing":[],"order":false,"removed":[],"status":"reworded","to":"9.5","types":[],"unlisted":[]},{"added":[],"attributes":[],"description_changed":true,"descriptions":[],"from":"9.5","listing":[],"order":false,"removed":[],"status":"reworded","to":"9.6","types":[],"unlisted":[]},{"added":[],"attributes":[],"description_changed":true,"descriptions":[],"from":"9.6","listing":[],"order":false,"removed":[],"status":"reworded","to":"10","types":[],"unlisted":[]},{"added":[],"attributes":[],"description_changed":false,"descriptions":[{"from":"Type of the lockable object: relation, extend, frozenid, page, tuple, transactionid, virtualxid, object, userlock, or advisory","name":"locktype","to":"Type of the lockable object: relation, extend, frozenid, page, tuple, transactionid, virtualxid, spectoken, object, userlock, or advisory. (See also Table 27.11.)"}],"from":"12","listing":[],"order":false,"removed":[],"status":"reworded","to":"13","types":[],"unlisted":[]},{"added":["waitstart"],"attributes":[],"description_changed":false,"descriptions":[{"from":"Type of the lockable object: relation, extend, frozenid, page, tuple, transactionid, virtualxid, spectoken, object, userlock, or advisory. (See also Table 27.11.)","name":"locktype","to":"Type of the lockable object: relation, extend, frozenid, page, tuple, transactionid, virtualxid, spectoken, object, userlock, or advisory. (See also Table 28.11.)"}],"from":"13","listing":[],"order":false,"removed":[],"status":"changed","to":"14","types":[],"unlisted":[]},{"added":[],"attributes":[],"description_changed":false,"descriptions":[{"from":"Type of the lockable object: relation, extend, frozenid, page, tuple, transactionid, virtualxid, spectoken, object, userlock, or advisory. (See also Table 28.11.)","name":"locktype","to":"Type of the lockable object: relation, extend, frozenid, page, tuple, transactionid, virtualxid, spectoken, object, userlock, advisory, or applytransaction. (See also Table 28.11.)"},{"from":"ID of the transaction targeted by the lock, or null if the target is not a transaction ID","name":"transactionid","to":"ID of the transaction targeted by the lock, or null if the target is not a transaction ID; Chapter 74"},{"from":"Virtual ID of the transaction targeted by the lock, or null if the target is not a virtual transaction ID","name":"virtualxid","to":"Virtual ID of the transaction targeted by the lock, or null if the target is not a virtual transaction ID; see Chapter 74"}],"from":"15","listing":[],"order":false,"removed":[],"status":"reworded","to":"16","types":[],"unlisted":[]},{"added":[],"attributes":[],"description_changed":false,"descriptions":[{"from":"Type of the lockable object: relation, extend, frozenid, page, tuple, transactionid, virtualxid, spectoken, object, userlock, advisory, or applytransaction. (See also Table 28.11.)","name":"locktype","to":"Type of the lockable object: relation, extend, frozenid, page, tuple, transactionid, virtualxid, spectoken, object, userlock, advisory, or applytransaction. (See also Table 27.11.)"},{"from":"ID of the transaction targeted by the lock, or null if the target is not a transaction ID; Chapter 74","name":"transactionid","to":"ID of the transaction targeted by the lock, or null if the target is not a transaction ID; Chapter 66"},{"from":"Virtual ID of the transaction targeted by the lock, or null if the target is not a virtual transaction ID; see Chapter 74","name":"virtualxid","to":"Virtual ID of the transaction targeted by the lock, or null if the target is not a virtual transaction ID; see Chapter 66"}],"from":"16","listing":[],"order":false,"removed":[],"status":"reworded","to":"17","types":[],"unlisted":[]},{"added":[],"attributes":[],"description_changed":false,"descriptions":[{"from":"ID of the transaction targeted by the lock, or null if the target is not a transaction ID; Chapter 66","name":"transactionid","to":"ID of the transaction targeted by the lock, or null if the target is not a transaction ID; Chapter 67"},{"from":"Virtual ID of the transaction targeted by the lock, or null if the target is not a virtual transaction ID; see Chapter 66","name":"virtualxid","to":"Virtual ID of the transaction targeted by the lock, or null if the target is not a virtual transaction ID; see Chapter 67"}],"from":"17","listing":[],"order":false,"removed":[],"status":"reworded","to":"18","types":[],"unlisted":[]},{"added":[],"attributes":[],"description_changed":false,"descriptions":[{"from":"True if lock was taken via fast path, false if taken via main lock table","name":"fastpath","to":"True if lock was taken via fast path, false if taken via main lock table (see Section 13.3.1.1)"}],"from":"19","listing":[],"order":false,"removed":[],"status":"reworded","to":"20","types":[],"unlisted":[]}],"column_count":16,"content_hash":"d48326d8c902cae77e4f3939042b49288c68c6e50bcb9d782b3959bb4fae2532","derived_content_hash":"78ce6b1f06ac0a0c17fe0fe599a4d3b645ec257ed2f70c4893208cefff23cb0d","first_version":"7.4","imported_at":"2026-09-30T00:40:55.613793+08:00","kind":"view","last_version":"20","name":"pg_locks","position":44,"present_in":["7.4","8.0","8.1","8.2","8.3","8.4","9.0","9.1","9.2","9.3","9.4","9.5","9.6","10","11","12","13","14","15","16","17","18","19","20"],"relation_oid":null,"relkind":"v","shared":false,"source_rev":"catalog-bilingual-repair:5a3c2d53c37ad9893f445ecc9a9fcbc573749f093b400185fb781d7a7df0f1c4","summary":"The view pg_locks provides access to information about the locks held by active processes within the database server.","summary_zh":"视图 pg_locks 提供了对数据库服务器中活动进程持有的锁的信息的访问。有关锁定的更多讨论，请参见第 13 章。"}},"Definition":{"Collection":"catalog","Key":"pg_locks","SourceDatabase":"center","Version":"18","SourceTable":"catalog","SourceKey":"pg_locks","SourceRevision":"catalog-bilingual-repair:5a3c2d53c37ad9893f445ecc9a9fcbc573749f093b400185fb781d7a7df0f1c4","Facts":{"columns":[{"array_dimensions":0,"attnum":1,"description":"Type of the lockable object: relation, extend, frozenid, page, tuple, transactionid, virtualxid, spectoken, object, userlock, advisory, or applytransaction. (See also Table 27.11.)","description_zh":"可锁定对象的类型：relation，extend，frozenid，page，tuple，transactionid，virtualxid，spectoken，object，userlock，advisory 或 applytransaction。（另请参见表 27.11。）","documented":true,"documented_name":"locktype","hidden":false,"name":"locktype","not_null":false,"references":"","type":"text","type_modifier":-1,"type_oid":25,"zh_from":"same-version-manual"},{"array_dimensions":0,"attnum":2,"description":"OID of the database in which the lock target exists, or zero if the target is a shared object, or null if the target is a transaction ID","description_zh":"锁目标存在的数据库的 OID，如果目标是一个共享对象则为 0，如果目标是一个事务 ID 则为 NULL","documented":true,"documented_name":"database","hidden":false,"name":"database","not_null":false,"references":"pg_database.oid","type":"oid","type_modifier":-1,"type_oid":26,"zh_from":"same-version-manual"},{"array_dimensions":0,"attnum":3,"description":"OID of the relation targeted by the lock, or null if the target is not a relation or part of a relation","description_zh":"作为锁目标的关系的 OID，如果目标既不是关系，也不是关系的一部分则此列为 NULL","documented":true,"documented_name":"relation","hidden":false,"name":"relation","not_null":false,"references":"pg_class.oid","type":"oid","type_modifier":-1,"type_oid":26,"zh_from":"same-version-manual"},{"array_dimensions":0,"attnum":4,"description":"Page number targeted by the lock within the relation, or null if the target is not a relation page or tuple","description_zh":"作为锁目标的页在关系中的页号，如果目标不是一个关系页或元组则此列为 NULL","documented":true,"documented_name":"page","hidden":false,"name":"page","not_null":false,"references":"","type":"int4","type_modifier":-1,"type_oid":23,"zh_from":"same-version-manual"},{"array_dimensions":0,"attnum":5,"description":"Tuple number targeted by the lock within the page, or null if the target is not a tuple","description_zh":"作为锁目标的元组在页中的元组号，如果目标不是一个元组则此列为 NULL","documented":true,"documented_name":"tuple","hidden":false,"name":"tuple","not_null":false,"references":"","type":"int2","type_modifier":-1,"type_oid":21,"zh_from":"same-version-manual"},{"array_dimensions":0,"attnum":6,"description":"Virtual ID of the transaction targeted by the lock, or null if the target is not a virtual transaction ID; see Chapter 67","description_zh":"作为锁目标的事务的虚拟 ID，如果目标不是虚拟事务 ID，则为 NULL；见第 67 章","documented":true,"documented_name":"virtualxid","hidden":false,"name":"virtualxid","not_null":false,"references":"","type":"text","type_modifier":-1,"type_oid":25,"zh_from":"same-version-manual"},{"array_dimensions":0,"attnum":7,"description":"ID of the transaction targeted by the lock, or null if the target is not a transaction ID; Chapter 67","description_zh":"作为锁目标的事务的 ID，如果目标不是事务 ID，则为 NULL；第 67 章","documented":true,"documented_name":"transactionid","hidden":false,"name":"transactionid","not_null":false,"references":"","type":"xid","type_modifier":-1,"type_oid":28,"zh_from":"same-version-manual"},{"array_dimensions":0,"attnum":8,"description":"OID of the system catalog containing the lock target, or null if the target is not a general database object","description_zh":"包含锁目标的系统目录的 OID，如果目标不是一个普通数据库对象则此列为 NULL","documented":true,"documented_name":"classid","hidden":false,"name":"classid","not_null":false,"references":"pg_class.oid","type":"oid","type_modifier":-1,"type_oid":26,"zh_from":"same-version-manual"},{"array_dimensions":0,"attnum":9,"description":"OID of the lock target within its system catalog, or null if the target is not a general database object","description_zh":"锁目标在它的系统目录中的 OID，如果目标不是一个普通数据库对象则为 NULL","documented":true,"documented_name":"objid","hidden":false,"name":"objid","not_null":false,"references":"","type":"oid","type_modifier":-1,"type_oid":26,"zh_from":"same-version-manual"},{"array_dimensions":0,"attnum":10,"description":"Column number targeted by the lock (the classid and objid refer to the table itself), or zero if the target is some other general database object, or null if the target is not a general database object","description_zh":"锁的目标列号（classid 和 objid 指表本身），如果目标是某种其他普通数据库对象则此列为 0，如果目标不是一个普通数据库对象则此列为 NULL","documented":true,"documented_name":"objsubid","hidden":false,"name":"objsubid","not_null":false,"references":"","type":"int2","type_modifier":-1,"type_oid":21,"zh_from":"same-version-manual"},{"array_dimensions":0,"attnum":11,"description":"Virtual ID of the transaction that is holding or awaiting this lock","description_zh":"持有这个锁或者正在等待这个锁的事务的虚拟 ID","documented":true,"documented_name":"virtualtransaction","hidden":false,"name":"virtualtransaction","not_null":false,"references":"","type":"text","type_modifier":-1,"type_oid":25,"zh_from":"same-version-manual"},{"array_dimensions":0,"attnum":12,"description":"Process ID of the server process holding or awaiting this lock, or null if the lock is held by a prepared transaction","description_zh":"持有这个锁或者正在等待这个锁的服务器进程的 PID，如果此锁被一个预备事务所持有则此列为 NULL","documented":true,"documented_name":"pid","hidden":false,"name":"pid","not_null":false,"references":"","type":"int4","type_modifier":-1,"type_oid":23,"zh_from":"same-version-manual"},{"array_dimensions":0,"attnum":13,"description":"Name of the lock mode held or desired by this process (see Section 13.3.1 and Section 13.2.3)","description_zh":"此进程已持有或者希望持有的锁模式的名称（参见第 13.3.1 节和第 13.2.3 节）","documented":true,"documented_name":"mode","hidden":false,"name":"mode","not_null":false,"references":"","type":"text","type_modifier":-1,"type_oid":25,"zh_from":"same-version-manual"},{"array_dimensions":0,"attnum":14,"description":"True if lock is held, false if lock is awaited","description_zh":"如果锁已授予则为真，如果锁被等待则为假","documented":true,"documented_name":"granted","hidden":false,"name":"granted","not_null":false,"references":"","type":"bool","type_modifier":-1,"type_oid":16,"zh_from":"same-version-manual"},{"array_dimensions":0,"attnum":15,"description":"True if lock was taken via fast path, false if taken via main lock table","description_zh":"如果锁通过快速路径获得则为真，通过主锁表获得则为假","documented":true,"documented_name":"fastpath","hidden":false,"name":"fastpath","not_null":false,"references":"","type":"bool","type_modifier":-1,"type_oid":16,"zh_from":"same-version-manual"},{"array_dimensions":0,"attnum":16,"description":"Time when the server process started waiting for this lock, or null if the lock is held. Note that this can be null for a very short period of time after the wait started even though granted is false.","description_zh":"服务器进程开始等待该锁的时间；如果锁已被授予则为 NULL。注意，在开始等待之后，即使 granted 为 false，该值在极短时间内也可能仍为 NULL。","documented":true,"documented_name":"waitstart","hidden":false,"name":"waitstart","not_null":false,"references":"","type":"timestamptz","type_modifier":-1,"type_oid":1184,"zh_from":"same-version-manual"}],"description":"The view pg_locks provides access to information about the locks held by active processes within the database server. See Chapter 13 for more discussion of locking.\n\npg_locks contains one row per active lockable object, requested lock mode, and relevant process. Thus, the same lockable object might appear many times, if multiple processes are holding or waiting for locks on it. However, an object that currently has no locks on it will not appear at all.\n\nThere are several distinct types of lockable objects: whole relations (e.g., tables), individual pages of relations, individual tuples of relations, transaction IDs (both virtual and permanent IDs), and general database objects (identified by class OID and object OID, in the same way as in pg_description or pg_depend). Also, the right to extend a relation is represented as a separate lockable object, as is the right to update pg_database.datfrozenxid. Also, “advisory” locks can be taken on numbers that have user-defined meanings.","description_zh":"视图 pg_locks 提供了对数据库服务器中活动进程持有的锁的信息的访问。有关锁定的更多讨论，请参见第 13 章。\n\npg_locks 为每个活动的可锁定对象、请求的锁模式及相关进程的组合提供一行。因此，如果多个进程正在持有或等待锁定它，同一可锁定对象可能会出现多次。但是，当前没有任何锁定的对象将不会出现。\n\n有几种不同类型的可锁定对象：整个关系（例如，表），关系的单个页面，关系的单个元组，事务 ID（虚拟和永久 ID 均包括），以及一般的数据库对象（由类 OID 和对象 OID 标识，与 pg_description 或 pg_depend 中的方式相同）。此外，扩展关系的权利被表示为单独的可锁定对象，更新 pg_database.datfrozenxid 的权利也是如此。此外，还可以对具有用户定义含义的数字施加“咨询锁”。","description_zh_html":"\u003cp\u003e视图 pg_locks 提供了对数据库服务器中活动进程持有的锁的信息的访问。有关锁定的更多讨论，请参见第 13 章。\u003c/p\u003e\n\u003cp\u003epg_locks 为每个活动的可锁定对象、请求的锁模式及相关进程的组合提供一行。因此，如果多个进程正在持有或等待锁定它，同一可锁定对象可能会出现多次。但是，当前没有任何锁定的对象将不会出现。\u003c/p\u003e\n\u003cp\u003e有几种不同类型的可锁定对象：整个关系（例如，表），关系的单个页面，关系的单个元组，事务 ID（虚拟和永久 ID 均包括），以及一般的数据库对象（由类 OID 和对象 OID 标识，与 pg_description 或 pg_depend 中的方式相同）。此外，扩展关系的权利被表示为单独的可锁定对象，更新 pg_database.datfrozenxid 的权利也是如此。此外，还可以对具有用户定义含义的数字施加“咨询锁”。\u003c/p\u003e","doc":{"anchor":"id-1.10.5.17.6","file":"view-pg-locks.html","lang":"en","sha256":"3a7d854d209880ee811d10a349a5dc4a13b1496cf08cbdabbdcba73c05958ad2","slug":"18"},"kind":"view","lang":"en","measured_attributes":true,"metadata_release":"18.6","runtime_columns":["locktype","database","relation","page","tuple","virtualxid","transactionid","classid","objid","objsubid","virtualtransaction","pid","mode","granted","fastpath","waitstart"],"runtime_verified":false,"source":"english-manual","sources":[{"evidence":[{"build_id":107,"kind":"same-version-manual","locale":"zh-Hans","page":"view-pg-locks.html","sha256":"7234658c1b3c80278e05401fb09ddd35c396a82897cdb5ce4912a1a8bf668a08","source_revision":"unknown:rendered-translation-baseline","translation_revision":"git:b1b500221dbe5437cfca004d6b04d3f6e422765d;html-sha256:08e987a66af27b98444a8057c256314eafa13611a3fb9e888214fc436824244b","version":"18"}],"kind":"catalog-bilingual-repair","prior_source_revision":"english-manuals:1a394737c3f59cb427706a23a53bb587470885cb6d5887f07ead65078241fc63","version":"18"}],"zh_from":"same-version-manual"},"ManualEvidence":{"doc":{"anchor":"id-1.10.5.17.6","file":"view-pg-locks.html","lang":"en","sha256":"3a7d854d209880ee811d10a349a5dc4a13b1496cf08cbdabbdcba73c05958ad2","slug":"18"},"sources":[{"evidence":[{"build_id":107,"kind":"same-version-manual","locale":"zh-Hans","page":"view-pg-locks.html","sha256":"7234658c1b3c80278e05401fb09ddd35c396a82897cdb5ce4912a1a8bf668a08","source_revision":"unknown:rendered-translation-baseline","translation_revision":"git:b1b500221dbe5437cfca004d6b04d3f6e422765d;html-sha256:08e987a66af27b98444a8057c256314eafa13611a3fb9e888214fc436824244b","version":"18"}],"kind":"catalog-bilingual-repair","prior_source_revision":"english-manuals:1a394737c3f59cb427706a23a53bb587470885cb6d5887f07ead65078241fc63","version":"18"}]},"MeasuredEvidence":{"measured_attributes":true,"metadata_release":"18.6","runtime_columns":["locktype","database","relation","page","tuple","virtualxid","transactionid","classid","objid","objsubid","virtualtransaction","pid","mode","granted","fastpath","waitstart"],"runtime_verified":false}},"Text":{"Collection":"catalog","Key":"pg_locks","SourceDatabase":"center","Version":"18","Locale":"en","Title":"pg_locks","Summary":"The view pg_locks provides access to information about the locks held by active processes within the database server. See Chapter 13 for more discussion of locking.\n\npg_locks contains one row per active lockable object, requested lock mode, and relevant process. Thus, the same lockable object might appear many times, if multiple processes are holding or waiting for locks on it. However, an object that currently has no locks on it will not appear at all.\n\nThere are several distinct types of lockable objects: whole relations (e.g., tables), individual pages of relations, individual tuples of relations, transaction IDs (both virtual and permanent IDs), and general database objects (identified by class OID and object OID, in the same way as in pg_description or pg_depend). Also, the right to extend a relation is represented as a separate lockable object, as is the right to update pg_database.datfrozenxid. Also, “advisory” locks can be taken on numbers that have user-defined meanings.","BodyHTML":"\u003cp\u003eThe view pg_locks provides access to information about the locks held by active processes within the database server. See Chapter 13 for more discussion of locking.\n\npg_locks contains one row per active lockable object, requested lock mode, and relevant process. Thus, the same lockable object might appear many times, if multiple processes are holding or waiting for locks on it. However, an object that currently has no locks on it will not appear at all.\n\nThere are several distinct types of lockable objects: whole relations (e.g., tables), individual pages of relations, individual tuples of relations, transaction IDs (both virtual and permanent IDs), and general database objects (identified by class OID and object OID, in the same way as in pg_description or pg_depend). Also, the right to extend a relation is represented as a separate lockable object, as is the right to update pg_database.datfrozenxid. Also, “advisory” locks can be taken on numbers that have user-defined meanings.\u003c/p\u003e","SourceRevision":"catalog-bilingual-repair:5a3c2d53c37ad9893f445ecc9a9fcbc573749f093b400185fb781d7a7df0f1c4","ContentHash":"3c0c400a2b37ac54dd65deffc9d532b5f3772c6c3a98bb438fa802f6a790154d","Payload":{"columns":[{"array_dimensions":0,"attnum":1,"description":"Type of the lockable object: relation, extend, frozenid, page, tuple, transactionid, virtualxid, spectoken, object, userlock, advisory, or applytransaction. (See also Table 27.11.)","description_zh":"可锁定对象的类型：relation，extend，frozenid，page，tuple，transactionid，virtualxid，spectoken，object，userlock，advisory 或 applytransaction。（另请参见表 27.11。）","documented":true,"documented_name":"locktype","hidden":false,"name":"locktype","not_null":false,"references":"","type":"text","type_modifier":-1,"type_oid":25,"zh_from":"same-version-manual"},{"array_dimensions":0,"attnum":2,"description":"OID of the database in which the lock target exists, or zero if the target is a shared object, or null if the target is a transaction ID","description_zh":"锁目标存在的数据库的 OID，如果目标是一个共享对象则为 0，如果目标是一个事务 ID 则为 NULL","documented":true,"documented_name":"database","hidden":false,"name":"database","not_null":false,"references":"pg_database.oid","type":"oid","type_modifier":-1,"type_oid":26,"zh_from":"same-version-manual"},{"array_dimensions":0,"attnum":3,"description":"OID of the relation targeted by the lock, or null if the target is not a relation or part of a relation","description_zh":"作为锁目标的关系的 OID，如果目标既不是关系，也不是关系的一部分则此列为 NULL","documented":true,"documented_name":"relation","hidden":false,"name":"relation","not_null":false,"references":"pg_class.oid","type":"oid","type_modifier":-1,"type_oid":26,"zh_from":"same-version-manual"},{"array_dimensions":0,"attnum":4,"description":"Page number targeted by the lock within the relation, or null if the target is not a relation page or tuple","description_zh":"作为锁目标的页在关系中的页号，如果目标不是一个关系页或元组则此列为 NULL","documented":true,"documented_name":"page","hidden":false,"name":"page","not_null":false,"references":"","type":"int4","type_modifier":-1,"type_oid":23,"zh_from":"same-version-manual"},{"array_dimensions":0,"attnum":5,"description":"Tuple number targeted by the lock within the page, or null if the target is not a tuple","description_zh":"作为锁目标的元组在页中的元组号，如果目标不是一个元组则此列为 NULL","documented":true,"documented_name":"tuple","hidden":false,"name":"tuple","not_null":false,"references":"","type":"int2","type_modifier":-1,"type_oid":21,"zh_from":"same-version-manual"},{"array_dimensions":0,"attnum":6,"description":"Virtual ID of the transaction targeted by the lock, or null if the target is not a virtual transaction ID; see Chapter 67","description_zh":"作为锁目标的事务的虚拟 ID，如果目标不是虚拟事务 ID，则为 NULL；见第 67 章","documented":true,"documented_name":"virtualxid","hidden":false,"name":"virtualxid","not_null":false,"references":"","type":"text","type_modifier":-1,"type_oid":25,"zh_from":"same-version-manual"},{"array_dimensions":0,"attnum":7,"description":"ID of the transaction targeted by the lock, or null if the target is not a transaction ID; Chapter 67","description_zh":"作为锁目标的事务的 ID，如果目标不是事务 ID，则为 NULL；第 67 章","documented":true,"documented_name":"transactionid","hidden":false,"name":"transactionid","not_null":false,"references":"","type":"xid","type_modifier":-1,"type_oid":28,"zh_from":"same-version-manual"},{"array_dimensions":0,"attnum":8,"description":"OID of the system catalog containing the lock target, or null if the target is not a general database object","description_zh":"包含锁目标的系统目录的 OID，如果目标不是一个普通数据库对象则此列为 NULL","documented":true,"documented_name":"classid","hidden":false,"name":"classid","not_null":false,"references":"pg_class.oid","type":"oid","type_modifier":-1,"type_oid":26,"zh_from":"same-version-manual"},{"array_dimensions":0,"attnum":9,"description":"OID of the lock target within its system catalog, or null if the target is not a general database object","description_zh":"锁目标在它的系统目录中的 OID，如果目标不是一个普通数据库对象则为 NULL","documented":true,"documented_name":"objid","hidden":false,"name":"objid","not_null":false,"references":"","type":"oid","type_modifier":-1,"type_oid":26,"zh_from":"same-version-manual"},{"array_dimensions":0,"attnum":10,"description":"Column number targeted by the lock (the classid and objid refer to the table itself), or zero if the target is some other general database object, or null if the target is not a general database object","description_zh":"锁的目标列号（classid 和 objid 指表本身），如果目标是某种其他普通数据库对象则此列为 0，如果目标不是一个普通数据库对象则此列为 NULL","documented":true,"documented_name":"objsubid","hidden":false,"name":"objsubid","not_null":false,"references":"","type":"int2","type_modifier":-1,"type_oid":21,"zh_from":"same-version-manual"},{"array_dimensions":0,"attnum":11,"description":"Virtual ID of the transaction that is holding or awaiting this lock","description_zh":"持有这个锁或者正在等待这个锁的事务的虚拟 ID","documented":true,"documented_name":"virtualtransaction","hidden":false,"name":"virtualtransaction","not_null":false,"references":"","type":"text","type_modifier":-1,"type_oid":25,"zh_from":"same-version-manual"},{"array_dimensions":0,"attnum":12,"description":"Process ID of the server process holding or awaiting this lock, or null if the lock is held by a prepared transaction","description_zh":"持有这个锁或者正在等待这个锁的服务器进程的 PID，如果此锁被一个预备事务所持有则此列为 NULL","documented":true,"documented_name":"pid","hidden":false,"name":"pid","not_null":false,"references":"","type":"int4","type_modifier":-1,"type_oid":23,"zh_from":"same-version-manual"},{"array_dimensions":0,"attnum":13,"description":"Name of the lock mode held or desired by this process (see Section 13.3.1 and Section 13.2.3)","description_zh":"此进程已持有或者希望持有的锁模式的名称（参见第 13.3.1 节和第 13.2.3 节）","documented":true,"documented_name":"mode","hidden":false,"name":"mode","not_null":false,"references":"","type":"text","type_modifier":-1,"type_oid":25,"zh_from":"same-version-manual"},{"array_dimensions":0,"attnum":14,"description":"True if lock is held, false if lock is awaited","description_zh":"如果锁已授予则为真，如果锁被等待则为假","documented":true,"documented_name":"granted","hidden":false,"name":"granted","not_null":false,"references":"","type":"bool","type_modifier":-1,"type_oid":16,"zh_from":"same-version-manual"},{"array_dimensions":0,"attnum":15,"description":"True if lock was taken via fast path, false if taken via main lock table","description_zh":"如果锁通过快速路径获得则为真，通过主锁表获得则为假","documented":true,"documented_name":"fastpath","hidden":false,"name":"fastpath","not_null":false,"references":"","type":"bool","type_modifier":-1,"type_oid":16,"zh_from":"same-version-manual"},{"array_dimensions":0,"attnum":16,"description":"Time when the server process started waiting for this lock, or null if the lock is held. Note that this can be null for a very short period of time after the wait started even though granted is false.","description_zh":"服务器进程开始等待该锁的时间；如果锁已被授予则为 NULL。注意，在开始等待之后，即使 granted 为 false，该值在极短时间内也可能仍为 NULL。","documented":true,"documented_name":"waitstart","hidden":false,"name":"waitstart","not_null":false,"references":"","type":"timestamptz","type_modifier":-1,"type_oid":1184,"zh_from":"same-version-manual"}],"description":"The view pg_locks provides access to information about the locks held by active processes within the database server. See Chapter 13 for more discussion of locking.\n\npg_locks contains one row per active lockable object, requested lock mode, and relevant process. Thus, the same lockable object might appear many times, if multiple processes are holding or waiting for locks on it. However, an object that currently has no locks on it will not appear at all.\n\nThere are several distinct types of lockable objects: whole relations (e.g., tables), individual pages of relations, individual tuples of relations, transaction IDs (both virtual and permanent IDs), and general database objects (identified by class OID and object OID, in the same way as in pg_description or pg_depend). Also, the right to extend a relation is represented as a separate lockable object, as is the right to update pg_database.datfrozenxid. Also, “advisory” locks can be taken on numbers that have user-defined meanings."}},"RequestedLocale":"en","Fallback":false,"Versions":["10","11","12","13","14","15","16","17","18","19","20","7.4","8.0","8.1","8.2","8.3","8.4","9.0","9.1","9.2","9.3","9.4","9.5","9.6"],"Locales":["en","zh-Hans"],"Signatures":null,"Spellings":null,"SQLState":null,"Evidence":null}
