{"Entry":{"collection":"waitevent","key":"lwlock/BufferContent","name":"BufferContent","aliases":["BufferContent","buffer_content"],"metadata":{"aliases":["BufferContent","buffer_content"],"changed_in":["10","13"],"changes":[{"from":"9.6","moved":{"from":"LWLockTranche","to":"LWLock"},"renamed":null,"reworded":null,"status":"changed","to":"10"},{"from":"12","moved":null,"renamed":{"from":"buffer_content","to":"BufferContent"},"reworded":{"from":"Waiting to read or write a data page in memory.","to":"Waiting to access a data page in memory."},"status":"changed","to":"13"},{"from":"18","moved":null,"renamed":null,"reworded":null,"status":"removed","to":"19"}],"content_hash":"0eba45bda124dd137dd09fd9100f6f2d2a5559b4aeecdc841f51a4ff396fbd36","dossier":{"actions":{"en":["Find the relations and statements shared by the waiters.","Use page/index evidence to confirm a hotspot; do not infer one from the wait name alone.","Spread hot keys, batch writes, or move maintenance away from the peak before considering capacity changes."],"zh":["找出等待会话共同访问的关系与语句。","用页面与索引证据确认热点，不能只凭等待名称下结论。","先分散热点键、批量写入或错峰维护，再考虑容量调整。"]},"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 = 'LWLock'\n  AND wait_event = 'BufferContent'\nORDER BY query_age DESC NULLS LAST;","title":"Sessions waiting on LWLock/BufferContent","title_zh":"正在等待 LWLock/BufferContent 的会话"},{"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 = 'LWLock'\nGROUP BY wait_event\nORDER BY waiting_sessions DESC, wait_event;","title":"Current LWLock cohort","title_zh":"当前 LWLock 等待分布"},{"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 = 'LWLock'\n  AND a.wait_event = 'BufferContent'\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":["shared_buffers"],"incident_pattern":{"en":"A monotonically increasing key concentrates concurrent B-tree inserts on the rightmost leaf page; BufferContent rises with insert latency.","zh":"单调递增键让并发 B-tree 插入集中到最右叶子页，BufferContent 与插入延迟同步上升。"},"mechanism":{"en":"A backend has found the shared buffer it needs but cannot yet take that buffer descriptor's content lock. Heap and index code acquire this lock before reading or changing the in-memory page, so many workers touching one page can serialize here.","zh":"后端已经找到所需的共享缓冲区，但尚未取得该 buffer descriptor 的 content lock。堆表与索引代码在读取或修改内存页前都会取得此锁，因此大量工作进程访问同一页面时会在这里串行化。"},"metrics":["waiting_sessions","wait_event_share","statement_latency"],"normal":{"en":"Short samples are routine while concurrent readers and writers touch shared pages.","zh":"并发读写共享页面时，零星而短暂的样本很常见。"},"official_descriptions":{"13":"Waiting to access a data page in memory.","14":"Waiting to access a data page in memory.","15":"Waiting to access a data page in memory.","16":"Waiting to access a data page in memory.","17":"Waiting to access a data page in memory","18":"Waiting to access a data page in memory"},"record_kind":"event","source_locations":[{"commit":"724edf9bde9d356724ad384a2e196edc3c9f80f7","excerpt":"[LWTRANCHE_BUFFER_CONTENT] = \"BufferContent\",","grep_pattern":"BufferContent","grep_verified":true,"kind":"resource_path","line":148,"major":18,"path":"src/backend/storage/lmgr/lwlock.c","status":"dynamic_trigger","symbol":"BufferContent","tag":"REL_18_6","url":"https://github.com/postgres/postgres/blob/REL_18_6/src/backend/storage/lmgr/lwlock.c#L148","version":"18.6"},{"commit":"724edf9bde9d356724ad384a2e196edc3c9f80f7","excerpt":"pgstat_report_wait_start(PG_WAIT_LWLOCK | lock-\u003etranche);","grep_pattern":"pgstat_report_wait_start","grep_verified":true,"kind":"generic_reporter","line":739,"major":18,"path":"src/backend/storage/lmgr/lwlock.c","status":"dynamic_trigger","symbol":"pgstat_report_wait_start","tag":"REL_18_6","url":"https://github.com/postgres/postgres/blob/REL_18_6/src/backend/storage/lmgr/lwlock.c#L739","version":"18.6"},{"commit":"724edf9bde9d356724ad384a2e196edc3c9f80f7","excerpt":"BufferContent\t\"Waiting to access a data page in memory.\"","grep_pattern":"BufferContent","grep_verified":true,"kind":"catalog_definition","line":373,"major":18,"path":"src/backend/utils/activity/wait_event_names.txt","status":"dynamic_trigger","symbol":"BufferContent","tag":"REL_18_6","url":"https://github.com/postgres/postgres/blob/REL_18_6/src/backend/utils/activity/wait_event_names.txt#L373","version":"18.6"}],"source_status":"dynamic_trigger","trouble":{"en":"Repeated samples on many foreground sessions usually point to a hot heap/index page, a right-growing index, or concurrent maintenance on the same blocks.","zh":"大量前台会话连续命中时，通常指向热点堆表/索引页、向右增长的索引，或与业务同时访问相同块的维护任务。"}},"first_version":"9.6","has_dossier":true,"imported_at":"2026-09-27T17:57:32.878138+08:00","key":"lwlock/buffercontent","last_version":"18","name":"BufferContent","position":209,"present_in":["9.6","10","11","12","13","14","15","16","17","18"],"slug":"buffer-content","source_rev":"english-manuals:69ebafce563cce83f3154885eca610ee3ee9913264078508dbd65ecd82389373","summary":"Waiting to access a data page in memory.","summary_zh":"","type":"LWLock","type_slug":"lwlock","type_variants":["LWLock","LWLockTranche"]}},"Definition":{"Collection":"waitevent","Key":"lwlock/BufferContent","SourceDatabase":"center","Version":"18","SourceTable":"waitevent","SourceKey":"lwlock/buffercontent","SourceRevision":"english-manuals:69ebafce563cce83f3154885eca610ee3ee9913264078508dbd65ecd82389373","Facts":{"description":"Waiting to access a data page in memory.","description_zh":"","doc":{"anchor":"WAIT-EVENT-LWLOCK-TABLE","file":"monitoring-stats.html","lang":"en","sha256":"aa979eed08627fbf715a9d792094a162a73671db5af810f3ab2aad3e073d5722","slug":"18"},"lang":"en","name":"BufferContent","source":"english-manual","type":"LWLock","zh_from":""},"ManualEvidence":{"doc":{"anchor":"WAIT-EVENT-LWLOCK-TABLE","file":"monitoring-stats.html","lang":"en","sha256":"aa979eed08627fbf715a9d792094a162a73671db5af810f3ab2aad3e073d5722","slug":"18"}},"MeasuredEvidence":{}},"Text":{"Collection":"waitevent","Key":"lwlock/BufferContent","SourceDatabase":"pgweb","Version":"18","Locale":"zh-Hans","Title":"BufferContent","Summary":"等待访问内存中的数据页。","BodyHTML":"\u003cp\u003e等待访问内存中的数据页。\u003c/p\u003e","SourceRevision":"2026-08-31@34d13c8","ContentHash":"4e72896115fc17a9e53d8d4fd9af034de692702eb8d55700302d9106a4dc066f","Payload":{"description_zh":"等待访问内存中的数据页。","zh_from":"doc"}},"RequestedLocale":"zh-Hans","Fallback":false,"Versions":["10","11","12","13","14","15","16","17","18","9.6"],"Locales":["en","zh-Hans"],"Signatures":null,"Spellings":null,"SQLState":null,"Evidence":null}
