PostgreSQL pg_wait_sampling pg_wait_sampling_history 视图
1 背景知识
pg_wait_sampling_history 视图的所有的进程的等待事件,包括后台进程的历史记录。
2 查询视图
SELECT event,event_type,count(ts) FROM pg_wait_sampling_history
GROUP BY event, event_type;
event | event_type | count
----------------------+------------+-------
CheckpointWriteDelay | Timeout | 834
BgWriterMain | Activity | 20
BgWriterHibernate | Activity | 814
AutoVacuumMain | Activity | 833
ClientRead | Client | 832
LogicalLauncherMain | Activity | 833
WalWriterMain | Activity | 834
(7 rows)
3 视图详解
Column name | Column type | Description |
---|---|---|
pid | int4 | Id of process |
ts | timestamptz | Sample timestamp |
event_type | text | Name of wait event type |
event | text | Name of wait event |
queryid | int8 | Id of query |
4 参考链接
postgrespro/pg_wait_sampling: Sampling based statistics of wait events (github.com)