{"Entry":{"collection":"guc","key":"trace_locks","name":"trace_locks","aliases":[],"metadata":{"baseline":true,"boot_human":"Not specified","boot_val":null,"category":"Developer Options","category_zh":"","changed_in":[],"changes":[{"documentation_changed":true,"fields":{},"from":"8.3","status":"changed","to":"8.4"},{"documentation_changed":true,"fields":{},"from":"8.4","status":"changed","to":"9.0"}],"content_hash":"403bddb1f18bacf9b223229ae9936a998c31e000ac67833f7819824c5a7113b0","context":"","default_changed_in":[],"default_history":[],"derived_content_hash":"cd1de4aad10bdf1330a36912a6a464f60177a5ae757678c4a592379e9862db11","documentation_refresh":{"batch":"20261113","original_source_rev":"wiki-repair-20261023:2aa5cde317b18451d48d04224e1671aba25f96696c34ea9799f428397fa05c09","versions":{"14":"14.25","15":"15.20","16":"16.16","17":"17.12","18":"18.7","19":"19rc2"}},"editorial":{},"enumvals":[],"first_version":"7.4","group":"Developer Options","group_slug":"developer","imported_at":"2026-09-27T17:57:32.181675+08:00","intro_commit":{},"key":"trace_locks","last_version":"20","max_val":"","min_val":"","name":"trace_locks","position":419,"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"],"repair_provenance":{"original_source_revision":"wiki-repair-20261023:ffd5e7006a4bf7a2a59c9de770ed683c1e855798100f41a4908ca7d64138d0d7","receipt_sha256":"2da88ddeaae554b6da2b9ea5a34abc5a99b655ef4222f8140bea846e867fdf11","repair":"wiki-repair-20261023"},"short_desc":"If on, emit information about lock usage.","short_desc_zh":"","source_rev":"wiki-repair-20261023:2aa5cde317b18451d48d04224e1671aba25f96696c34ea9799f428397fa05c09","unit":"","vartype":"bool"}},"Definition":{"Collection":"guc","Key":"trace_locks","SourceDatabase":"center","Version":"18","SourceTable":"guc","SourceKey":"trace_locks","SourceRevision":"wiki-repair-20261023:2aa5cde317b18451d48d04224e1671aba25f96696c34ea9799f428397fa05c09","Facts":{"boot_val":null,"category":"Developer Options","context":"","description":"If on, emit information about lock usage. Information dumped includes the type of lock operation, the type of lock and the unique identifier of the object being locked or unlocked. Also included are bit masks for the lock types already granted on this object as well as for the lock types awaited on this object. For each lock type a count of the number of granted locks and waiting locks is also dumped as well as the totals. An example of the log file output is shown here: LOG: LockAcquire: new: lock(0xb7acd844) id(24688,24696,0,0,0,1) grantMask(0) req(0,0,0,0,0,0,0)=0 grant(0,0,0,0,0,0,0)=0 wait(0) type(AccessShareLock) LOG: GrantLock: lock(0xb7acd844) id(24688,24696,0,0,0,1) grantMask(2) req(1,0,0,0,0,0,0)=1 grant(1,0,0,0,0,0,0)=1 wait(0) type(AccessShareLock) LOG: UnGrantLock: updated: lock(0xb7acd844) id(24688,24696,0,0,0,1) grantMask(0) req(0,0,0,0,0,0,0)=0 grant(0,0,0,0,0,0,0)=0 wait(0) type(AccessShareLock) LOG: CleanUpLock: deleting: lock(0xb7acd844) id(24688,24696,0,0,0,1) grantMask(0) req(0,0,0,0,0,0,0)=0 grant(0,0,0,0,0,0,0)=0 wait(0) type(INVALID) Details of the structure being dumped may be found in src/include/storage/lock.h. This parameter is only available if the LOCK_DEBUG macro was defined when PostgreSQL was compiled.","description_zh":"如果开启，发出锁使用情况的信息。被转储信息中包括锁操作的类型、锁的类型和被锁或被解锁对象的唯一标识符。同样包括的还有已经授予这个对象的锁类型的位掩码和等待这个对象的锁类型的位掩码。还会转储每种锁类型已授予的锁数、等待的锁数，以及它们的总数。一个日志文件输出的示例如下： LOG: LockAcquire: new: lock(0xb7acd844) id(24688,24696,0,0,0,1) grantMask(0) req(0,0,0,0,0,0,0)=0 grant(0,0,0,0,0,0,0)=0 wait(0) type(AccessShareLock) LOG: GrantLock: lock(0xb7acd844) id(24688,24696,0,0,0,1) grantMask(2) req(1,0,0,0,0,0,0)=1 grant(1,0,0,0,0,0,0)=1 wait(0) type(AccessShareLock) LOG: UnGrantLock: updated: lock(0xb7acd844) id(24688,24696,0,0,0,1) grantMask(0) req(0,0,0,0,0,0,0)=0 grant(0,0,0,0,0,0,0)=0 wait(0) type(AccessShareLock) LOG: CleanUpLock: deleting: lock(0xb7acd844) id(24688,24696,0,0,0,1) grantMask(0) req(0,0,0,0,0,0,0)=0 grant(0,0,0,0,0,0,0)=0 wait(0) type(INVALID) 被转储结构体的详细信息可以在 src/include/storage/lock.h 中找到。 只有在编译 PostgreSQL 时定义了 LOCK_DEBUG 宏，这个参数才可用。","description_zh_html":"\u003cp\u003e\n        如果开启，发出锁使用情况的信息。被转储信息中包括锁操作的类型、锁的类型和被锁或被解锁对象的唯一标识符。同样包括的还有已经授予这个对象的锁类型的位掩码和等待这个对象的锁类型的位掩码。还会转储每种锁类型已授予的锁数、等待的锁数，以及它们的总数。一个日志文件输出的示例如下：\n\u003c/p\u003e\u003cpre class=\"screen\"\u003e\nLOG:  LockAcquire: new: lock(0xb7acd844) id(24688,24696,0,0,0,1)\n      grantMask(0) req(0,0,0,0,0,0,0)=0 grant(0,0,0,0,0,0,0)=0\n      wait(0) type(AccessShareLock)\nLOG:  GrantLock: lock(0xb7acd844) id(24688,24696,0,0,0,1)\n      grantMask(2) req(1,0,0,0,0,0,0)=1 grant(1,0,0,0,0,0,0)=1\n      wait(0) type(AccessShareLock)\nLOG:  UnGrantLock: updated: lock(0xb7acd844) id(24688,24696,0,0,0,1)\n      grantMask(0) req(0,0,0,0,0,0,0)=0 grant(0,0,0,0,0,0,0)=0\n      wait(0) type(AccessShareLock)\nLOG:  CleanUpLock: deleting: lock(0xb7acd844) id(24688,24696,0,0,0,1)\n      grantMask(0) req(0,0,0,0,0,0,0)=0 grant(0,0,0,0,0,0,0)=0\n      wait(0) type(INVALID)\n\u003c/pre\u003e\u003cp\u003e\n        被转储结构体的详细信息可以在 \u003ccode class=\"filename\"\u003esrc/include/storage/lock.h\u003c/code\u003e 中找到。\n       \u003c/p\u003e\u003cp\u003e\n        只有在编译 \u003cspan class=\"productname\"\u003ePostgreSQL\u003c/span\u003e 时定义了 \u003ccode class=\"symbol\"\u003eLOCK_DEBUG\u003c/code\u003e 宏，这个参数才可用。\n       \u003c/p\u003e","doc":{"anchor":"GUC-TRACE-LOCKS","file":"runtime-config-developer.html","lang":"en","sha256":"a3f6a107ed6ba4edaf6df03e52f4a469bd09350d545e4ff419e62844025ec1cf","slug":"18"},"doc_html":"\u003cp\u003e\n        If on, emit information about lock usage.  Information dumped\n        includes the type of lock operation, the type of lock and the unique\n        identifier of the object being locked or unlocked.  Also included\n        are bit masks for the lock types already granted on this object as\n        well as for the lock types awaited on this object.  For each lock\n        type a count of the number of granted locks and waiting locks is\n        also dumped as well as the totals.  An example of the log file output\n        is shown here:\n\u003c/p\u003e\u003cpre class=\"screen\"\u003e\nLOG:  LockAcquire: new: lock(0xb7acd844) id(24688,24696,0,0,0,1)\n      grantMask(0) req(0,0,0,0,0,0,0)=0 grant(0,0,0,0,0,0,0)=0\n      wait(0) type(AccessShareLock)\nLOG:  GrantLock: lock(0xb7acd844) id(24688,24696,0,0,0,1)\n      grantMask(2) req(1,0,0,0,0,0,0)=1 grant(1,0,0,0,0,0,0)=1\n      wait(0) type(AccessShareLock)\nLOG:  UnGrantLock: updated: lock(0xb7acd844) id(24688,24696,0,0,0,1)\n      grantMask(0) req(0,0,0,0,0,0,0)=0 grant(0,0,0,0,0,0,0)=0\n      wait(0) type(AccessShareLock)\nLOG:  CleanUpLock: deleting: lock(0xb7acd844) id(24688,24696,0,0,0,1)\n      grantMask(0) req(0,0,0,0,0,0,0)=0 grant(0,0,0,0,0,0,0)=0\n      wait(0) type(INVALID)\n\u003c/pre\u003e\u003cp\u003e\n        Details of the structure being dumped may be found in\n        \u003ccode class=\"filename\"\u003esrc/include/storage/lock.h\u003c/code\u003e.\n       \u003c/p\u003e\u003cp\u003e\n        This parameter is only available if the \u003ccode class=\"symbol\"\u003eLOCK_DEBUG\u003c/code\u003e\n        macro was defined when \u003cspan class=\"productname\"\u003ePostgreSQL\u003c/span\u003e was\n        compiled.\n       \u003c/p\u003e","doc_same_as":"","documentation_revision":{"inputs":[{"file":"runtime-config-developer.html","kind":"same-version-reviewed-manual","locale":"en","sha256":"a3f6a107ed6ba4edaf6df03e52f4a469bd09350d545e4ff419e62844025ec1cf","version":"18.7"},{"file":"runtime-config-developer.html","kind":"same-version-reviewed-manual","locale":"zh-Hans","sha256":"e7e22aa5738a1d376b84af1adca796c5e14746266733f925eb50c3ef86a50655","version":"18.7"}],"release":"18.7","runtime_remeasured":false,"source_revision":"pgdoc:b9f0e7232f60f380d642ac9b99226606c254b552"},"documented":true,"enumvals":[],"extra_desc":"","lang":"en","max_val":null,"metadata_version":"","min_val":null,"name":"trace_locks","short_desc":"","source":"english-manual","translation_provenance":{"inputs":[{"kind":"current-pgdoc-translation","path":"/Users/vonng/pgsty/pgdoc/zh/18/html/runtime-config-developer.html","sha256":"3c08bf624188bbb0733dc7854e61c0c251c2578311ac3dc8fa626ab21b7911d1"}],"kind":"same-version-pgdoc","locale":"zh-Hans","source_revision":"b1b500221dbe5437cfca004d6b04d3f6e422765d","version":"18"},"unit":"","vartype":"bool","zh_from":"same-version-manual"},"ManualEvidence":{"doc":{"anchor":"GUC-TRACE-LOCKS","file":"runtime-config-developer.html","lang":"en","sha256":"a3f6a107ed6ba4edaf6df03e52f4a469bd09350d545e4ff419e62844025ec1cf","slug":"18"}},"MeasuredEvidence":{"metadata_version":""}},"Text":{"Collection":"guc","Key":"trace_locks","SourceDatabase":"center","Version":"18","Locale":"en","Title":"trace_locks","Summary":"If on, emit information about lock usage. Information dumped includes the type of lock operation, the type of lock and the unique identifier of the object being locked or unlocked. Also included are bit masks for the lock types already granted on this object as well as for the lock types awaited on this object. For each lock type a count of the number of granted locks and waiting locks is also dumped as well as the totals. An example of the log file output is shown here: LOG: LockAcquire: new: lock(0xb7acd844) id(24688,24696,0,0,0,1) grantMask(0) req(0,0,0,0,0,0,0)=0 grant(0,0,0,0,0,0,0)=0 wait(0) type(AccessShareLock) LOG: GrantLock: lock(0xb7acd844) id(24688,24696,0,0,0,1) grantMask(2) req(1,0,0,0,0,0,0)=1 grant(1,0,0,0,0,0,0)=1 wait(0) type(AccessShareLock) LOG: UnGrantLock: updated: lock(0xb7acd844) id(24688,24696,0,0,0,1) grantMask(0) req(0,0,0,0,0,0,0)=0 grant(0,0,0,0,0,0,0)=0 wait(0) type(AccessShareLock) LOG: CleanUpLock: deleting: lock(0xb7acd844) id(24688,24696,0,0,0,1) grantMask(0) req(0,0,0,0,0,0,0)=0 grant(0,0,0,0,0,0,0)=0 wait(0) type(INVALID) Details of the structure being dumped may be found in src/include/storage/lock.h. This parameter is only available if the LOCK_DEBUG macro was defined when PostgreSQL was compiled.","BodyHTML":"\u003cp\u003e\n        If on, emit information about lock usage.  Information dumped\n        includes the type of lock operation, the type of lock and the unique\n        identifier of the object being locked or unlocked.  Also included\n        are bit masks for the lock types already granted on this object as\n        well as for the lock types awaited on this object.  For each lock\n        type a count of the number of granted locks and waiting locks is\n        also dumped as well as the totals.  An example of the log file output\n        is shown here:\n\u003c/p\u003e\u003cpre\u003e\nLOG:  LockAcquire: new: lock(0xb7acd844) id(24688,24696,0,0,0,1)\n      grantMask(0) req(0,0,0,0,0,0,0)=0 grant(0,0,0,0,0,0,0)=0\n      wait(0) type(AccessShareLock)\nLOG:  GrantLock: lock(0xb7acd844) id(24688,24696,0,0,0,1)\n      grantMask(2) req(1,0,0,0,0,0,0)=1 grant(1,0,0,0,0,0,0)=1\n      wait(0) type(AccessShareLock)\nLOG:  UnGrantLock: updated: lock(0xb7acd844) id(24688,24696,0,0,0,1)\n      grantMask(0) req(0,0,0,0,0,0,0)=0 grant(0,0,0,0,0,0,0)=0\n      wait(0) type(AccessShareLock)\nLOG:  CleanUpLock: deleting: lock(0xb7acd844) id(24688,24696,0,0,0,1)\n      grantMask(0) req(0,0,0,0,0,0,0)=0 grant(0,0,0,0,0,0,0)=0\n      wait(0) type(INVALID)\n\u003c/pre\u003e\u003cp\u003e\n        Details of the structure being dumped may be found in\n        \u003ccode\u003esrc/include/storage/lock.h\u003c/code\u003e.\n       \u003c/p\u003e\u003cp\u003e\n        This parameter is only available if the \u003ccode\u003eLOCK_DEBUG\u003c/code\u003e\n        macro was defined when \u003cspan\u003ePostgreSQL\u003c/span\u003e was\n        compiled.\n       \u003c/p\u003e","SourceRevision":"wiki-repair-20261023:2aa5cde317b18451d48d04224e1671aba25f96696c34ea9799f428397fa05c09","ContentHash":"a3571a6ea95ad255e57499b86b1544595687a5621b8daa273be32cd48ba9bd84","Payload":{"description":"If on, emit information about lock usage. Information dumped includes the type of lock operation, the type of lock and the unique identifier of the object being locked or unlocked. Also included are bit masks for the lock types already granted on this object as well as for the lock types awaited on this object. For each lock type a count of the number of granted locks and waiting locks is also dumped as well as the totals. An example of the log file output is shown here: LOG: LockAcquire: new: lock(0xb7acd844) id(24688,24696,0,0,0,1) grantMask(0) req(0,0,0,0,0,0,0)=0 grant(0,0,0,0,0,0,0)=0 wait(0) type(AccessShareLock) LOG: GrantLock: lock(0xb7acd844) id(24688,24696,0,0,0,1) grantMask(2) req(1,0,0,0,0,0,0)=1 grant(1,0,0,0,0,0,0)=1 wait(0) type(AccessShareLock) LOG: UnGrantLock: updated: lock(0xb7acd844) id(24688,24696,0,0,0,1) grantMask(0) req(0,0,0,0,0,0,0)=0 grant(0,0,0,0,0,0,0)=0 wait(0) type(AccessShareLock) LOG: CleanUpLock: deleting: lock(0xb7acd844) id(24688,24696,0,0,0,1) grantMask(0) req(0,0,0,0,0,0,0)=0 grant(0,0,0,0,0,0,0)=0 wait(0) type(INVALID) Details of the structure being dumped may be found in src/include/storage/lock.h. This parameter is only available if the LOCK_DEBUG macro was defined when PostgreSQL was compiled."}},"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}
