此条目涉及PostgreSQL的一个功能,该功能是PostgreSQL 17的一部分,预计将于2024年底发布。
pg_wait_events
是一个提供等待事件描述的系统目录视图。
pg_wait_events
在PostgreSQL 17中添加。
更改历史
- PostgreSQL 17
- 添加(提交1e68e43d)
示例
pg_wait_events
的示例内容
postgres=# SELECT * FROM pg_wait_events LIMIT 3; type | name | description ----------+-------------------+----------------------------------------------------- Activity | ArchiverMain | Waiting in main loop of archiver process Activity | AutoVacuumMain | Waiting in main loop of autovacuum launcher process Activity | BgWriterHibernate | Waiting in background writer process, hibernating (3 rows)
pg_wait_events
可以与pg_stat_activity
连接
postgres=# SELECT psa.pid, psa.application_name, psa.wait_event, we.description FROM pg_stat_activity psa JOIN pg_wait_events we ON (psa.wait_event_type = we.type AND psa.wait_event = we.name); pid | application_name | wait_event | description -------+------------------+---------------------+-------------------------------------------------------------- 16252 | | AutoVacuumMain | Waiting in main loop of autovacuum launcher process 16249 | | BgWriterMain | Waiting in main loop of background writer process 16248 | | CheckpointerMain | Waiting in main loop of checkpointer process 16253 | | LogicalLauncherMain | Waiting in main loop of logical replication launcher process 16251 | | WalWriterMain | Waiting in main loop of WAL writer process (5 rows)
参考文献
- PostgreSQL 17文档: pg_wait_events