@@ -27,24 +27,22 @@ When `pg_wait_sampling` is enabled, it collects two kinds of statistics.
2727 a client who periodically read this history and dump it somewhere, user
2828 can have continuous history.
2929 * 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
3132 table can be reset by user request. Assuming there is a client who
3233 periodically dumps profile and resets it, user can have statistics of
3334 intensivity of wait events among time.
3435
36+ In combination with ` pg_stat_statements ` this extension can also provide
37+ per query statistics.
38+
3539` pg_wait_sampling ` launches special background worker for gathering the
3640statistics above.
3741
38- Authors
39- -------
40-
41- * Alexander Korotkov <
[email protected] >, Postgres Professional,
42- Moscow, Russia
43-
4442Availability
4543------------
4644
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
4846PostgreSQL installation. It is available from
4947[ github] ( https://github.com/postgrespro/pg_wait_sampling )
5048under the same license as
@@ -88,6 +86,7 @@ all processed including background workers.
8886| pid | int4 | Id of process |
8987| event_type | text | Name of wait event type |
9088| event | text | Name of wait event |
89+ | queryid | int8 | Id of query |
9190
9291` pg_wait_sampling_get_current(pid int4) ` returns the same table for single given
9392process.
@@ -101,6 +100,7 @@ in-memory ring buffer.
101100| ts | timestamptz | Sample timestamp |
102101| event_type | text | Name of wait event type |
103102| event | text | Name of wait event |
103+ | queryid | int8 | Id of query |
104104
105105` pg_wait_sampling_profile ` view – profile of wait events obtained by sampling into
106106in-memory hash table.
@@ -110,29 +110,33 @@ in-memory hash table.
110110| pid | int4 | Id of process |
111111| event_type | text | Name of wait event type |
112112| event | text | Name of wait event |
113+ | queryid | int8 | Id of query |
113114| count | text | Count of samples |
114115
115116` pg_wait_sampling_reset_profile() ` function resets the profile.
116117
117118The work of wait event statistics collector worker is controlled by following
118119GUCs.
119120
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 |
126128
127129If ` pg_wait_sampling.profile_pid ` is set to false, sampling profile wouldn't be
128130collected in per-process manner. In this case the value of pid could would
129131be always zero and corresponding row contain samples among all the processes.
130132
133+ While ` pg_wait_sampling.profile_queries ` is set to false ` queryid ` field in
134+ views will be zero.
135+
131136These GUCs are allowed to be changed by superuser. Also, they are placed into
132137shared memory. Thus, they could be changed from any backend and affects worker
133138runtime.
134139
135-
136140See
137141[ PostgreSQL documentation] ( http://www.postgresql.org/docs/devel/static/monitoring-stats.html#WAIT-EVENT-TABLE )
138142for list of possible wait events.
@@ -148,3 +152,11 @@ your bug reports.
148152If you're lacking of some functionality in ` pg_wait_sampling ` and feeling power
149153to implement it then you're welcome to make pull requests.
150154
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