{"Entry":{"collection":"waitevent","key":"lock/page","name":"page","aliases":["page"],"metadata":{"aliases":["page"],"changed_in":["13"],"changes":[{"from":"12","moved":null,"renamed":null,"reworded":{"from":"Waiting to acquire a lock on page of a relation.","to":"Waiting to acquire a lock on a page of a relation."},"status":"changed","to":"13"}],"content_hash":"7f55952a9330f6045911a0945f9f76ec8edc6ad18ba57f0350c732201c8a938d","dossier":{"actions":{"en":["Build the pg_blocking_pids graph to its root.","Inspect the root holder's state, transaction age, and business purpose.","Choose cancellation, timeout, or workload sequencing only after identifying the safest root action."],"zh":["沿 pg_blocking_pids 构建到根节点的阻塞图。","检查根持有者状态、事务年龄与业务目的。","确认最安全的根动作后，再选择取消、超时或调整负载顺序。"]},"diagnostic_sql":[{"id":"sessions","min_version":"13","sql":"SELECT pid, backend_type, usename, datname, application_name,\n       state, now() - query_start AS query_age,\n       now() - xact_start AS xact_age,\n       wait_event_type, wait_event,\n       pg_blocking_pids(pid) AS blocking_pids,\n       left(query, 160) AS query\nFROM pg_stat_activity\nWHERE wait_event_type = 'Lock'\n  AND wait_event = 'page'\nORDER BY query_age DESC NULLS LAST;","title":"Sessions waiting on Lock/page","title_zh":"正在等待 Lock/page 的会话"},{"id":"cohort","min_version":"13","sql":"SELECT wait_event, count(*) AS waiting_sessions,\n       count(*) FILTER (WHERE state = 'active') AS active_waiters,\n       max(now() - query_start) AS oldest_query\nFROM pg_stat_activity\nWHERE wait_event_type = 'Lock'\nGROUP BY wait_event\nORDER BY waiting_sessions DESC, wait_event;","title":"Current Lock cohort","title_zh":"当前 Lock 等待分布"},{"id":"lock_objects","min_version":"13","sql":"SELECT a.pid, l.locktype, l.mode, l.granted, l.fastpath,\n       d.datname, n.nspname, c.relname,\n       l.page, l.tuple, l.virtualxid, l.transactionid,\n       l.classid, l.objid, l.objsubid\nFROM pg_stat_activity AS a\nLEFT JOIN pg_locks AS l ON l.pid = a.pid\nLEFT JOIN pg_database AS d ON d.oid = l.database\nLEFT JOIN pg_class AS c\n  ON c.oid = l.relation\n AND l.database = (\n       SELECT oid FROM pg_database WHERE datname = current_database()\n     )\nLEFT JOIN pg_namespace AS n ON n.oid = c.relnamespace\nWHERE a.wait_event_type = 'Lock'\n  AND a.wait_event = 'page'\nORDER BY a.pid, l.granted, l.locktype, l.mode;","title":"Lock and relation context for these sessions","title_zh":"这些会话的锁与关系上下文"}],"emission":{"status":"active","verified_release":"18.6"},"gucs":["lock_timeout","deadlock_timeout"],"incident_pattern":{"en":"","zh":""},"mechanism":{"en":"`PG_WAIT_LOCK` at `src/backend/storage/lmgr/proc.c:1487` is the grep-verified reporting path. The public identity/resource is mapped at `src/backend/utils/activity/wait_event_names.txt:421`. The instrumented operation is: Waiting to acquire a lock on a page of a relation. The lock manager could not grant the page heavyweight lock immediately. ProcSleep reports the lock wait and parks the backend on the lock's wait queue until owners release or the request is cancelled.","zh":"`PG_WAIT_LOCK` 位于 `src/backend/storage/lmgr/proc.c:1487`，是经 grep 核验的报告路径。公共身份/资源映射位于 `src/backend/utils/activity/wait_event_names.txt:421`。探针覆盖的操作是：等待获取 relation 页面上的锁。锁管理器无法立即授予 page 重量级锁；ProcSleep 报告等待，并把后端挂到该锁的等待队列，直到持有者释放或请求被取消。"},"metrics":["waiting_sessions","wait_event_share","blocked_sessions","locks_per_backend"],"normal":{"en":"Sub-second handoff during ordinary writes or planned DDL can be normal.","zh":"普通写入或计划内 DDL 的亚秒级锁交接可能正常。"},"official_descriptions":{"13":"Waiting to acquire a lock on a page of a relation.","14":"Waiting to acquire a lock on a page of a relation.","15":"Waiting to acquire a lock on a page of a relation.","16":"Waiting to acquire a lock on a page of a relation.","17":"Waiting to acquire a lock on a page of a relation","18":"Waiting to acquire a lock on a page of a relation"},"record_kind":"event","source_locations":[{"commit":"724edf9bde9d356724ad384a2e196edc3c9f80f7","excerpt":"PG_WAIT_LOCK | locallock-\u003etag.lock.locktag_type);","grep_pattern":"PG_WAIT_LOCK","grep_verified":true,"kind":"generic_reporter","line":1487,"major":18,"path":"src/backend/storage/lmgr/proc.c","status":"dynamic_trigger","symbol":"PG_WAIT_LOCK","tag":"REL_18_6","url":"https://github.com/postgres/postgres/blob/REL_18_6/src/backend/storage/lmgr/proc.c#L1487","version":"18.6"},{"commit":"724edf9bde9d356724ad384a2e196edc3c9f80f7","excerpt":"page\t\"Waiting to acquire a lock on a page of a relation.\"","grep_pattern":"page","grep_verified":true,"kind":"catalog_definition","line":421,"major":18,"path":"src/backend/utils/activity/wait_event_names.txt","status":"dynamic_trigger","symbol":"page","tag":"REL_18_6","url":"https://github.com/postgres/postgres/blob/REL_18_6/src/backend/utils/activity/wait_event_names.txt#L421","version":"18.6"}],"source_status":"dynamic_trigger","trouble":{"en":"Investigate once a user-facing wait breaches its latency objective, a blocking chain grows, or the root holder is idle in transaction.","zh":"面向用户的等待超过延迟目标、阻塞链持续增长，或根持有者处于 idle in transaction 时，应当调查。"}},"first_version":"9.6","has_dossier":true,"imported_at":"2026-09-27T17:57:32.841257+08:00","key":"lock/page","last_version":"20","name":"page","position":192,"present_in":["9.6","10","11","12","13","14","15","16","17","18","19","20"],"slug":"page","source_rev":"english-manuals:c2d57addc1cc905b645c6a67210c4ffa7c1422f778a351138df168824430d8c0","summary":"Waiting to acquire a lock on a page of a relation.","summary_zh":"","type":"Lock","type_slug":"lock","type_variants":["Lock"]}},"Definition":{"Collection":"waitevent","Key":"lock/page","SourceDatabase":"center","Version":"18","SourceTable":"waitevent","SourceKey":"lock/page","SourceRevision":"english-manuals:c2d57addc1cc905b645c6a67210c4ffa7c1422f778a351138df168824430d8c0","Facts":{"description":"Waiting to acquire a lock on a page of a relation.","description_zh":"","doc":{"anchor":"WAIT-EVENT-LOCK-TABLE","file":"monitoring-stats.html","lang":"en","sha256":"aa979eed08627fbf715a9d792094a162a73671db5af810f3ab2aad3e073d5722","slug":"18"},"lang":"en","name":"page","source":"english-manual","type":"Lock","zh_from":""},"ManualEvidence":{"doc":{"anchor":"WAIT-EVENT-LOCK-TABLE","file":"monitoring-stats.html","lang":"en","sha256":"aa979eed08627fbf715a9d792094a162a73671db5af810f3ab2aad3e073d5722","slug":"18"}},"MeasuredEvidence":{}},"Text":{"Collection":"waitevent","Key":"lock/page","SourceDatabase":"pgweb","Version":"18","Locale":"zh-Hans","Title":"page","Summary":"等待获取一个关系页面上的锁。","BodyHTML":"\u003cp\u003e等待获取一个关系页面上的锁。\u003c/p\u003e","SourceRevision":"2026-08-31@34d13c8","ContentHash":"9f1188a82c5ce16f4e16ff82012207fbc4395891ca7c87a44a61d9827653e0f5","Payload":{"description_zh":"等待获取一个关系页面上的锁。","zh_from":"doc"}},"RequestedLocale":"zh-Hans","Fallback":false,"Versions":["10","11","12","13","14","15","16","17","18","19","20","9.6"],"Locales":["en","zh-Hans"],"Signatures":null,"Spellings":null,"SQLState":null,"Evidence":null}
