{"Entry":{"collection":"waitevent","key":"lwlock/Autovacuum","name":"Autovacuum","aliases":["Autovacuum","AutovacuumLock"],"metadata":{"aliases":["Autovacuum","AutovacuumLock"],"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":"AutovacuumLock","to":"Autovacuum"},"reworded":{"from":"Autovacuum worker or launcher waiting to update or read the current state of autovacuum workers.","to":"Waiting to read or update the current state of autovacuum workers."},"status":"changed","to":"13"}],"content_hash":"26dd09645e40c69bd8f261f71223093811d580c81240698897357d8929ed810d","dossier":{"actions":{"en":["Repeat the snapshot and isolate one hot tranche.","Correlate it with the protected resource and current workload phase.","Reduce the specific contention source; adding concurrency can make a shared-memory hotspot worse."],"zh":["重复采样并锁定一个热点 tranche。","把它与受保护资源及当前负载阶段关联。","降低具体竞争源；增加并发可能让共享内存热点更糟。"]},"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 = 'Autovacuum'\nORDER BY query_age DESC NULLS LAST;","title":"Sessions waiting on LWLock/Autovacuum","title_zh":"正在等待 LWLock/Autovacuum 的会话"},{"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 = 'Autovacuum'\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_naptime"],"incident_pattern":{"en":"","zh":""},"mechanism":{"en":"`pgstat_report_wait_start` at `src/backend/storage/lmgr/lwlock.c:739` is the grep-verified reporting path. The public identity/resource is mapped at `src/backend/postmaster/autovacuum.c:611`. The instrumented operation is: Waiting to read or update the current state of autovacuum workers. LWLockAcquire could not immediately take the lightweight-lock tranche displayed as Autovacuum. The generic LWLock reporter publishes the tranche name while the backend sleeps on the internal shared-memory resource.","zh":"`pgstat_report_wait_start` 位于 `src/backend/storage/lmgr/lwlock.c:739`，是经 grep 核验的报告路径。公共身份/资源映射位于 `src/backend/postmaster/autovacuum.c:611`。探针覆盖的操作是：等待读取或更新 autovacuum worker 的当前状态。LWLockAcquire 无法立即取得显示为 Autovacuum 的轻量级锁 tranche；后端在内部共享内存资源上休眠时，通用 LWLock 报告器发布该 tranche 名称。"},"metrics":["waiting_sessions","wait_event_share","oldest_transaction_age"],"normal":{"en":"A brief sample is normal around short internal critical sections.","zh":"短暂内部临界区周围的零星样本属于正常。"},"official_descriptions":{"13":"Waiting to read or update the current state of autovacuum workers.","14":"Waiting to read or update the current state of autovacuum workers.","15":"Waiting to read or update the current state of autovacuum workers.","16":"Waiting to read or update the current state of autovacuum workers.","17":"Waiting to read or update the current state of autovacuum workers","18":"Waiting to read or update the current state of autovacuum workers"},"record_kind":"event","source_locations":[{"commit":"724edf9bde9d356724ad384a2e196edc3c9f80f7","excerpt":"LWLockAcquire(AutovacuumLock, LW_EXCLUSIVE);","grep_pattern":"Autovacuum","grep_verified":true,"kind":"resource_path","line":611,"major":18,"path":"src/backend/postmaster/autovacuum.c","status":"dynamic_trigger","symbol":"Autovacuum","tag":"REL_18_6","url":"https://github.com/postgres/postgres/blob/REL_18_6/src/backend/postmaster/autovacuum.c#L611","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":"Autovacuum\t\"Waiting to read or update the current state of autovacuum workers.\"","grep_pattern":"Autovacuum","grep_verified":true,"kind":"catalog_definition","line":329,"major":18,"path":"src/backend/utils/activity/wait_event_names.txt","status":"dynamic_trigger","symbol":"Autovacuum","tag":"REL_18_6","url":"https://github.com/postgres/postgres/blob/REL_18_6/src/backend/utils/activity/wait_event_names.txt#L329","version":"18.6"}],"source_status":"dynamic_trigger","trouble":{"en":"Investigate when the same tranche affects at least 10% of active foreground sessions in three consecutive one-second samples; treat 25% or waits beyond five seconds as urgent.","zh":"若同一 tranche 在连续三次一秒采样中影响至少 10% 的活动前台会话，应当调查；达到 25% 或持续超过五秒按紧急处理。"}},"first_version":"9.6","has_dossier":true,"imported_at":"2026-09-27T17:57:32.869639+08:00","key":"lwlock/autovacuum","last_version":"20","name":"Autovacuum","position":204,"present_in":["9.6","10","11","12","13","14","15","16","17","18","19","20"],"slug":"autovacuum","source_rev":"english-manuals:2810d3a8c4cc92a9fe5d566eb6f3c59f20ac1dd3b5e6523f6e1edbb0618b5bcb","summary":"Waiting to read or update the current state of autovacuum workers.","summary_zh":"","type":"LWLock","type_slug":"lwlock","type_variants":["LWLock","LWLockNamed"]}},"Definition":{"Collection":"waitevent","Key":"lwlock/Autovacuum","SourceDatabase":"center","Version":"18","SourceTable":"waitevent","SourceKey":"lwlock/autovacuum","SourceRevision":"english-manuals:2810d3a8c4cc92a9fe5d566eb6f3c59f20ac1dd3b5e6523f6e1edbb0618b5bcb","Facts":{"description":"Waiting to read or update the current state of autovacuum workers.","description_zh":"","doc":{"anchor":"WAIT-EVENT-LWLOCK-TABLE","file":"monitoring-stats.html","lang":"en","sha256":"aa979eed08627fbf715a9d792094a162a73671db5af810f3ab2aad3e073d5722","slug":"18"},"lang":"en","name":"Autovacuum","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/Autovacuum","SourceDatabase":"pgweb","Version":"18","Locale":"zh-Hans","Title":"Autovacuum","Summary":"等待读取或更新自动清理工作进程的当前状态。","BodyHTML":"\u003cp\u003e等待读取或更新自动清理工作进程的当前状态。\u003c/p\u003e","SourceRevision":"2026-08-31@34d13c8","ContentHash":"5e336e3e6aea4ec8318f9f2a5704d41adb4dc049c3daf3cdecc983c19a6550ad","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}
