{"Entry":{"collection":"waitevent","key":"lwlock/XactSLRU","name":"XactSLRU","aliases":["CLogControlLock","XactSLRU"],"metadata":{"aliases":["CLogControlLock","XactSLRU"],"changed_in":["10","13"],"changes":[{"from":"9.6","moved":{"from":"LWLockNamed","to":"LWLock"},"renamed":null,"reworded":null,"status":"changed","to":"10"},{"from":"12","moved":null,"renamed":{"from":"CLogControlLock","to":"XactSLRU"},"reworded":{"from":"Waiting to read or update transaction status.","to":"Waiting to access the transaction status SLRU cache."},"status":"changed","to":"13"}],"content_hash":"09af13a99ee84ff7b2d4963f78ca958768412bf792cc25c19b9fac3785359b71","dossier":{"actions":{"en":["Check old transactions and vacuum/freeze health.","Correlate with XactBuffer and pg_xact I/O waits.","Remove visibility-horizon blockers and restore vacuum progress before changing SLRU-related capacity."],"zh":["检查老事务以及 vacuum/freeze 健康度。","关联 XactBuffer 与 pg_xact I/O 等待。","先消除可见性边界阻塞者并恢复清理进度，再考虑容量调整。"]},"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 = 'XactSLRU'\nORDER BY query_age DESC NULLS LAST;","title":"Sessions waiting on LWLock/XactSLRU","title_zh":"正在等待 LWLock/XactSLRU 的会话"},{"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 = 'XactSLRU'\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":["autovacuum_freeze_max_age","vacuum_freeze_table_age"],"incident_pattern":{"en":"A long-lived snapshot prevents cleanup while queries revisit cold, old tuple versions, creating pg_xact cache churn and XactSLRU contention.","zh":"长生命周期快照阻止清理，同时查询反复访问冷的旧元组版本，引发 pg_xact 缓存抖动与 XactSLRU 竞争。"},"mechanism":{"en":"The transaction-status SLRU lock protects pg_xact cache metadata and pages while PostgreSQL reads or updates transaction commit status. Visibility checks for uncached or old XIDs can bring this path into the foreground.","zh":"事务状态 SLRU 锁保护 pg_xact 缓存元数据与页面，PostgreSQL 读取或更新事务提交状态时会经过这里。对未缓存或很老 XID 的可见性检查会把这条路径带到前台。"},"metrics":["waiting_sessions","wait_event_share","oldest_transaction_age","xact_slru_io"],"normal":{"en":"Short waits accompany transaction completion and occasional pg_xact cache misses.","zh":"事务结束与偶发 pg_xact 缓存未命中会带来短暂等待。"},"official_descriptions":{"13":"Waiting to access the transaction status SLRU cache.","14":"Waiting to access the transaction status SLRU cache.","15":"Waiting to access the transaction status SLRU cache.","16":"Waiting to access the transaction status SLRU cache.","17":"Waiting to access the transaction status SLRU cache","18":"Waiting to access the transaction status SLRU cache"},"record_kind":"event","source_locations":[{"commit":"724edf9bde9d356724ad384a2e196edc3c9f80f7","excerpt":"[LWTRANCHE_XACT_SLRU] = \"XactSLRU\",","grep_pattern":"XactSLRU","grep_verified":true,"kind":"resource_path","line":178,"major":18,"path":"src/backend/storage/lmgr/lwlock.c","status":"dynamic_trigger","symbol":"XactSLRU","tag":"REL_18_6","url":"https://github.com/postgres/postgres/blob/REL_18_6/src/backend/storage/lmgr/lwlock.c#L178","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":"XactSLRU\t\"Waiting to access the transaction status SLRU cache.\"","grep_pattern":"XactSLRU","grep_verified":true,"kind":"catalog_definition","line":403,"major":18,"path":"src/backend/utils/activity/wait_event_names.txt","status":"dynamic_trigger","symbol":"XactSLRU","tag":"REL_18_6","url":"https://github.com/postgres/postgres/blob/REL_18_6/src/backend/utils/activity/wait_event_names.txt#L403","version":"18.6"}],"source_status":"dynamic_trigger","trouble":{"en":"Persistent waits can indicate transaction-status cache churn, access to very old tuples, or storage latency on the pg_xact path.","zh":"持续等待可能表示事务状态缓存抖动、访问很老的元组，或 pg_xact 路径存在存储延迟。"}},"first_version":"9.6","has_dossier":true,"imported_at":"2026-09-27T17:57:33.089253+08:00","key":"lwlock/xactslru","last_version":"20","name":"XactSLRU","position":289,"present_in":["9.6","10","11","12","13","14","15","16","17","18","19","20"],"slug":"xact-slru","source_rev":"english-manuals:bdb02de3c5629bac1c0a0d9ab5c08a9823ef7e42e6d2f528b1ce30c2bc2c9af9","summary":"Waiting to access the transaction status SLRU cache.","summary_zh":"","type":"LWLock","type_slug":"lwlock","type_variants":["LWLock","LWLockNamed"]}},"Definition":{"Collection":"waitevent","Key":"lwlock/XactSLRU","SourceDatabase":"center","Version":"18","SourceTable":"waitevent","SourceKey":"lwlock/xactslru","SourceRevision":"english-manuals:bdb02de3c5629bac1c0a0d9ab5c08a9823ef7e42e6d2f528b1ce30c2bc2c9af9","Facts":{"description":"Waiting to access the transaction status SLRU cache.","description_zh":"","doc":{"anchor":"WAIT-EVENT-LWLOCK-TABLE","file":"monitoring-stats.html","lang":"en","sha256":"aa979eed08627fbf715a9d792094a162a73671db5af810f3ab2aad3e073d5722","slug":"18"},"lang":"en","name":"XactSLRU","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/XactSLRU","SourceDatabase":"pgweb","Version":"18","Locale":"zh-Hans","Title":"XactSLRU","Summary":"等待访问事务状态的SLRU缓存。","BodyHTML":"\u003cp\u003e等待访问事务状态的SLRU缓存。\u003c/p\u003e","SourceRevision":"2026-08-31@34d13c8","ContentHash":"121c728189a097879c9a96b93d59bc5a0f9b19a8fd095436c3b0d32f65992d34","Payload":{"description_zh":"等待访问事务状态的SLRU缓存。","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}
