PostgreSQL pg_wait_sampling pg_wait_sampling_profile 视图
1 背景知识
pg_wait_sampling_profile 视图 记录所有等待事件的统计信息,包括每个等待事件的类型和发生次数。
2 查询视图
SELECT * FROM pg_wait_sampling_profile;
pid | event_type | event | queryid | count
-------+------------+----------------------+---------------------+--------
56341 | IO | DataFileRead | 0 | 1
56336 | Activity | WalWriterMain | 0 | 315712
56333 | Timeout | CheckpointWriteDelay | 0 | 1424
56336 | IO | WALSync | 0 | 4
56339 | Activity | LogicalLauncherMain | 0 | 315716
56576 | Client | ClientRead | 0 | 477
56346 | IO | DataFileRead | 0 | 1
56333 | IO | DataFileFlush | 0 | 1
56577 | Client | ClientRead | 4151069060637635437 | 4672
56577 | Client | ClientRead | 0 | 96480
56334 | Activity | BgWriterHibernate | 0 | 297455
56351 | IO | DataFileRead | 0 | 3
56334 | Activity | BgWriterMain | 0 | 18260
56333 | Activity | CheckpointerMain | 0 | 314289
56337 | Activity | AutoVacuumMain | 0 | 315716
56554 | Client | ClientRead | 0 | 27141
56343 | IO | DataFileRead | 0 | 1
56361 | Client | ClientRead | 0 | 124918
56346 | Client | ClientRead | 0 | 2402
56349 | IO | DataFileRead | 0 | 2
(20 rows)
3 视图详解
Column name | Column type | Description |
---|---|---|
pid | int4 | Id of process |
event_type | text | Name of wait event type |
event | text | Name of wait event |
queryid | int8 | Id of query |
count | text | Count of samples |
4 参考链接
postgrespro/pg_wait_sampling: Sampling based statistics of wait events (github.com)