Skip to content

Commit 01c45a4

Browse files
committed
Fix and add info about sampling dimensions to README
1 parent 42b4828 commit 01c45a4

File tree

1 file changed

+25
-56
lines changed

1 file changed

+25
-56
lines changed

README.md

Lines changed: 25 additions & 56 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ When `pg_wait_sampling` is enabled, it collects two kinds of statistics.
3131
a client who periodically reads this history and dumps it somewhere, user
3232
can have continuous history of wait events.
3333
* Waits profile. It's implemented as in-memory hash table where samples
34-
are accumulated per each wait event and can be divided by process,
34+
are accumulated per each wait event and can be divided by process, wait event,
3535
query and other dimensions. This hash table can be reset by user request.
3636
Assuming there is a client who periodically dumps profile and resets it,
3737
user can have statistics of wait events over time.
@@ -99,20 +99,6 @@ Usage
9999
`pg_wait_sampling_current` view – information about current wait events for
100100
all processes including background workers.
101101

102-
| Column name | Column type | Description |
103-
| ----------- | ----------- | ----------------------- |
104-
| pid | int4 | Id of process |
105-
| event_type | text | Name of wait event type |
106-
| event | text | Name of wait event |
107-
| queryid | int8 | Id of query |
108-
109-
`pg_wait_sampling_get_current(pid int4)` returns the same table for single given
110-
process.
111-
112-
`pg_wait_sampling_current_extended` view – information about current wait events for
113-
all processes including background workers. Structure of this view can be changed
114-
between verions.
115-
116102
| Column name | Column type | Description |
117103
| ------------------- | ----------- | --------------------------- |
118104
| pid | int4 | Id of process |
@@ -129,28 +115,15 @@ between verions.
129115
| client_hostname | text | Client hostname |
130116
| appname | text | Application name |
131117

132-
`pg_wait_sampling_get_current_extended(pid int4)` returns the same table for single given
118+
`pg_wait_sampling_get_current(pid int4)` returns the same table for single given
133119
process.
134120

135121
`pg_wait_sampling_history` view – history of wait events obtained by sampling into
136122
in-memory ring buffer.
137123

138-
| Column name | Column type | Description |
139-
| ----------- | ----------- | ----------------------- |
140-
| pid | int4 | Id of process |
141-
| ts | timestamptz | Sample timestamp |
142-
| event_type | text | Name of wait event type |
143-
| event | text | Name of wait event |
144-
| queryid | int8 | Id of query |
145-
146-
`pg_wait_sampling_history_extended` view – history of wait events obtained by
147-
sampling into in-memory ring buffer. Structure of this view can be changed
148-
between verions
149-
150124
| Column name | Column type | Description |
151125
| ------------------- | ----------- | --------------------------- |
152126
| pid | int4 | Id of process |
153-
| ts | timestamptz | Sample timestamp |
154127
| event_type | text | Name of wait event type |
155128
| event | text | Name of wait event |
156129
| queryid | int8 | Id of query |
@@ -163,22 +136,13 @@ between verions
163136
| client_addr | text | Client address |
164137
| client_hostname | text | Client hostname |
165138
| appname | text | Application name |
139+
| ts | timestamptz | Sample timestamp |
140+
141+
`pg_wait_sampling_reset_history()` function resets the history.
166142

167143
`pg_wait_sampling_profile` view – profile of wait events obtained by sampling into
168144
in-memory hash table.
169145

170-
| Column name | Column type | Description |
171-
| ----------- | ----------- | ----------------------- |
172-
| pid | int4 | Id of process |
173-
| event_type | text | Name of wait event type |
174-
| event | text | Name of wait event |
175-
| queryid | int8 | Id of query |
176-
| count | int8 | Count of samples |
177-
178-
`pg_wait_sampling_profile_extended` view – history of wait events obtained by
179-
sampling into in-memory ring buffer. Structure of this view can be changed
180-
between verions
181-
182146
| Column name | Column type | Description |
183147
| ------------------- | ----------- | --------------------------- |
184148
| pid | int4 | Id of process |
@@ -201,16 +165,16 @@ between verions
201165
The work of wait event statistics collector worker is controlled by following
202166
GUCs.
203167

204-
| Parameter name | Data type | Description | Default value |
205-
|-------------------------------------| --------- |---------------------------------------------|--------------:|
206-
| pg_wait_sampling.history_size | int4 | Size of history in-memory ring buffer | 5000 |
207-
| pg_wait_sampling.history_period | int4 | Period for history sampling in milliseconds | 10 |
208-
| pg_wait_sampling.profile_period | int4 | Period for profile sampling in milliseconds | 10 |
209-
| pg_wait_sampling.profile_pid | bool | Whether profile should be per pid | true |
210-
| pg_wait_sampling.profile_queries | enum | Whether profile should be per query | top |
211-
| pg_wait_sampling.sample_cpu | bool | Whether on CPU backends should be sampled | true |
212-
| pg_wait_sampling.history_dimensions | text | Additional columns in extended history view | 'none' |
213-
| pg_wait_sampling.profile_dimensions | text | Additional columns in extended profile view | 'none' |
168+
| Parameter name | Data type | Description | Default value |
169+
|-------------------------------------| --------- |---------------------------------------------|----------------------------------------------|
170+
| pg_wait_sampling.history_size | int4 | Size of history in-memory ring buffer | 5000 |
171+
| pg_wait_sampling.history_period | int4 | Period for history sampling in milliseconds | 10 |
172+
| pg_wait_sampling.profile_period | int4 | Period for profile sampling in milliseconds | 10 |
173+
| pg_wait_sampling.profile_pid | bool | Whether profile should be per pid | true |
174+
| pg_wait_sampling.profile_queries | enum | Whether profile should be per query | top |
175+
| pg_wait_sampling.sample_cpu | bool | Whether on CPU backends should be sampled | true |
176+
| pg_wait_sampling.history_dimensions | text | Additional columns in extended history view | 'pid, wait_event_type, wait_event, query_id' |
177+
| pg_wait_sampling.profile_dimensions | text | Additional columns in extended profile view | 'pid, wait_event_type, wait_event, query_id' |
214178

215179
If `pg_wait_sampling.profile_pid` is set to false, sampling profile wouldn't be
216180
collected in per-process manner. In this case the value of pid could would
@@ -226,10 +190,11 @@ will be NULL.
226190

227191
`pg_wait_sampling.history_dimenstions` and `pg_wait_sampling.profile_dimensions`
228192
determine what additional columns will be sampled in `history/profile_extended`
229-
views. Possible values are `none`, `all`, `role_id`, `database_id`,
230-
`parallel_leader_pid`, `backend_type`, `backend_state`, `backend_start_time`,
231-
`client_addr`, `client_hostname`, `appname` and any combination of column names.
232-
`none` and `all` cannot be used together with any other values and must be used alone.
193+
views. Possible values are `all`, `pid`, `wait_event_type`, `wait_event`,
194+
`query_id`, `role_id`, `database_id`, `parallel_leader_pid`, `backend_type`,
195+
`backend_state`, `backend_start_time`, `client_addr`, `client_hostname`,
196+
`appname` and any combination of column names.
197+
`all` cannot be used together with any other values and must be used alone.
233198

234199
> [!WARNING]
235200
> Turning on any of the following columns: `backend_type`, `backend_state`,
@@ -238,9 +203,13 @@ views. Possible values are `none`, `all`, `role_id`, `database_id`,
238203
> BackendStatusTable. This is especially noticeable with PostgreSQL 13-16
239204
240205
Values of these GUC variables can be changed only in config file or with ALTER SYSTEM.
241-
Then you need to reload server's configuration (such as with pg_reload_conf function)
206+
Then you need to reload server's configuration (such as with `pg_reload_conf` function)
242207
for changes to take effect.
243208

209+
> [!WARNING]
210+
> When using `pg_reload_conf` you also need to invoke `pg_wait_sampling_reset_history()`
211+
> and `pg_wait_sampling_reset_profile()` for correct application of new dimensions
212+
244213
See
245214
[PostgreSQL documentation](http://www.postgresql.org/docs/devel/static/monitoring-stats.html#WAIT-EVENT-TABLE)
246215
for list of possible wait events.

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy