@@ -27,24 +27,22 @@ When `pg_wait_sampling` is enabled, it collects two kinds of statistics.
27
27
a client who periodically read this history and dump it somewhere, user
28
28
can have continuous history.
29
29
* Waits profile. It's implemented as in-memory hash table where count
30
- of samples are accumulated per each process and each wait event. This hash
30
+ of samples are accumulated per each process and each wait event
31
+ (and each query with ` pg_stat_statements ` ). This hash
31
32
table can be reset by user request. Assuming there is a client who
32
33
periodically dumps profile and resets it, user can have statistics of
33
34
intensivity of wait events among time.
34
35
36
+ In combination with ` pg_stat_statements ` this extension can also provide
37
+ per query statistics.
38
+
35
39
` pg_wait_sampling ` launches special background worker for gathering the
36
40
statistics above.
37
41
38
- Authors
39
- -------
40
-
41
- * Alexander Korotkov <
[email protected] >, Postgres Professional,
42
- Moscow, Russia
43
-
44
42
Availability
45
43
------------
46
44
47
- ` pg_wait_sampling ` is realized as an extension and not available in default
45
+ ` pg_wait_sampling ` is implemented as an extension and not available in default
48
46
PostgreSQL installation. It is available from
49
47
[ github] ( https://github.com/postgrespro/pg_wait_sampling )
50
48
under the same license as
@@ -88,6 +86,7 @@ all processed including background workers.
88
86
| pid | int4 | Id of process |
89
87
| event_type | text | Name of wait event type |
90
88
| event | text | Name of wait event |
89
+ | queryid | int8 | Id of query |
91
90
92
91
` pg_wait_sampling_get_current(pid int4) ` returns the same table for single given
93
92
process.
@@ -101,6 +100,7 @@ in-memory ring buffer.
101
100
| ts | timestamptz | Sample timestamp |
102
101
| event_type | text | Name of wait event type |
103
102
| event | text | Name of wait event |
103
+ | queryid | int8 | Id of query |
104
104
105
105
` pg_wait_sampling_profile ` view – profile of wait events obtained by sampling into
106
106
in-memory hash table.
@@ -110,29 +110,33 @@ in-memory hash table.
110
110
| pid | int4 | Id of process |
111
111
| event_type | text | Name of wait event type |
112
112
| event | text | Name of wait event |
113
+ | queryid | int8 | Id of query |
113
114
| count | text | Count of samples |
114
115
115
116
` pg_wait_sampling_reset_profile() ` function resets the profile.
116
117
117
118
The work of wait event statistics collector worker is controlled by following
118
119
GUCs.
119
120
120
- | Parameter name | Data type | Description | Default value |
121
- | ------------------------------- | --------- | ------------------------------------------- | ------------: |
122
- | pg_wait_sampling.history_size | int4 | Size of history in-memory ring buffer | 5000 |
123
- | pg_wait_sampling.history_period | int4 | Period for history sampling in milliseconds | 10 |
124
- | pg_wait_sampling.profile_period | int4 | Period for profile sampling in milliseconds | 10 |
125
- | pg_wait_sampling.profile_pid | bool | Whether profile should be per pid | true |
121
+ | Parameter name | Data type | Description | Default value |
122
+ | ----------------------------------- | --------- | ------------------------------------------- | ------------: |
123
+ | pg_wait_sampling.history_size | int4 | Size of history in-memory ring buffer | 5000 |
124
+ | pg_wait_sampling.history_period | int4 | Period for history sampling in milliseconds | 10 |
125
+ | pg_wait_sampling.profile_period | int4 | Period for profile sampling in milliseconds | 10 |
126
+ | pg_wait_sampling.profile_pid | bool | Whether profile should be per pid | true |
127
+ | pg_wait_sampling.profile_queries | bool | Whether profile should be per query | false |
126
128
127
129
If ` pg_wait_sampling.profile_pid ` is set to false, sampling profile wouldn't be
128
130
collected in per-process manner. In this case the value of pid could would
129
131
be always zero and corresponding row contain samples among all the processes.
130
132
133
+ While ` pg_wait_sampling.profile_queries ` is set to false ` queryid ` field in
134
+ views will be zero.
135
+
131
136
These GUCs are allowed to be changed by superuser. Also, they are placed into
132
137
shared memory. Thus, they could be changed from any backend and affects worker
133
138
runtime.
134
139
135
-
136
140
See
137
141
[ PostgreSQL documentation] ( http://www.postgresql.org/docs/devel/static/monitoring-stats.html#WAIT-EVENT-TABLE )
138
142
for list of possible wait events.
@@ -148,3 +152,11 @@ your bug reports.
148
152
If you're lacking of some functionality in ` pg_wait_sampling ` and feeling power
149
153
to implement it then you're welcome to make pull requests.
150
154
155
+ Authors
156
+ -------
157
+
158
+ * Alexander Korotkov <
[email protected] >, Postgres Professional,
159
+ Moscow, Russia
160
+ * Ildus Kurbangaliev <
[email protected] >, Postgres Professional,
161
+ Moscow, Russia
162
+
0 commit comments