1
- pg \_ wait \_ sampling – sampling based statistics of wait events
1
+ ` pg_wait_sampling ` – sampling based statistics of wait events
2
2
=============================================================
3
3
4
4
Introduction
@@ -7,29 +7,29 @@ Introduction
7
7
PostgreSQL 9.6+ provides an information about current wait event of particular
8
8
process. However, in order to gather descriptive statistics of server
9
9
behavior user have to sample current wait event multiple times.
10
- pg \_ wait \_ sampling is an extension for collecting sampling statistics of wait
10
+ ` pg_wait_sampling ` is an extension for collecting sampling statistics of wait
11
11
events.
12
12
13
- The module must be loaded by addingpg \_ wait \_ sampling to
14
- shared \_ preload \_ libraries in postgresql.conf, because it requires additional
13
+ The module must be loaded by adding` pg_wait_sampling ` to
14
+ ` shared_preload_libraries ` in postgresql.conf, because it requires additional
15
15
shared memory and launches background worker. This means that a server restart
16
16
is needed to add or remove the module.
17
17
18
- Whenpg \_ wait \_ sampling is enabled, it collects two kinds of statistics.
18
+ When` pg_wait_sampling ` is enabled, it collects two kinds of statistics.
19
19
20
20
* History of waits events. It's implemented as in-memory ring buffer where
21
21
samples of each process wait events are written with given (configurable)
22
22
period. Therefore, for each running process user can see some number of
23
23
recent samples depending on history size (configurable). Assuming there is
24
24
a client who periodically read this history and dump it somewhere, user
25
- can have continuous history.
25
+ can have continuous history.
26
26
* Waits profile. It's implemented as in-memory hash table where count
27
27
of samples are accumulated per each process and each wait event. This hash
28
28
table can be reset by user request. Assuming there is a client who
29
29
periodically dumps profile and resets it, user can have statistics of
30
- intensivity of wait events among time.
30
+ intensivity of wait events among time.
31
31
32
- pg \_ wait \_ sampling launches special background worker for gathering the
32
+ ` pg_wait_sampling ` launches special background worker for gathering the
33
33
statistics above.
34
34
35
35
Authors
@@ -41,7 +41,7 @@ Authors
41
41
Availability
42
42
------------
43
43
44
- pg \_ wait \_ sampling is realized as an extension and not available in default
44
+ ` pg_wait_sampling ` is realized as an extension and not available in default
45
45
PostgreSQL installation. It is available from
46
46
[ github] ( https://github.com/postgrespro/pg_wait_sampling )
47
47
under the same license as
@@ -51,13 +51,13 @@ and supports PostgreSQL 9.6+.
51
51
Installation
52
52
------------
53
53
54
- pg \_ wait \_ sampling is PostgreSQL extension which requires PostgreSQL 9.6 or
55
- higher. Before build and install you should ensure following:
56
-
54
+ ` pg_wait_sampling ` is PostgreSQL extension which requires PostgreSQL 9.6 or
55
+ higher. Before build and install you should ensure following:
56
+
57
57
* PostgreSQL version is 9.6 or higher.
58
58
* You have development package of PostgreSQL installed or you built
59
59
PostgreSQL from source.
60
- * Your PATH variable is configured so thatpg \_ config command available, or
60
+ * Your PATH variable is configured so that` pg_config ` command available, or
61
61
set PG_CONFIG variable.
62
62
63
63
Typical installation procedure may look like this:
@@ -69,15 +69,15 @@ Typical installation procedure may look like this:
69
69
$ make USE_PGXS=1 installcheck
70
70
$ psql DB -c "CREATE EXTENSION pg_wait_sampling;"
71
71
72
- Complilation on Windows is not supported, since the extension uses symbols from PostgreSQL
72
+ Compilation on Windows is not supported, since the extension uses symbols from PostgreSQL
73
73
that are not exported.
74
74
75
75
Usage
76
76
-----
77
77
78
- pg \_ wait \_ sampling interacts with user by set of views and functions.
78
+ ` pg_wait_sampling ` interacts with user by set of views and functions.
79
79
80
- pg \_ wait \_ sampling \_ current view – information about current wait events for
80
+ ` pg_wait_sampling_current ` view – information about current wait events for
81
81
all processed including background workers.
82
82
83
83
| Column name| Column type| Description|
@@ -86,10 +86,10 @@ all processed including background workers.
86
86
| event_type| text| Name of wait event type|
87
87
| event| text| Name of wait event|
88
88
89
- pg_wait_sampling_get_current(pid int4) returns the same table for single given
89
+ ` pg_wait_sampling_get_current(pid int4) ` returns the same table for single given
90
90
process.
91
91
92
- pg \_ wait \_ sampling \_ history view – history of wait events obtained by sampling into
92
+ ` pg_wait_sampling_history ` view – history of wait events obtained by sampling into
93
93
in-memory ring buffer.
94
94
95
95
| Column name| Column type| Description|
@@ -99,7 +99,7 @@ in-memory ring buffer.
99
99
| event_type| text| Name of wait event type|
100
100
| event| text| Name of wait event|
101
101
102
- pg \_ wait \_ sampling \_ profile view – profile of wait events obtained by sampling into
102
+ ` pg_wait_sampling_profile ` view – profile of wait events obtained by sampling into
103
103
in-memory hash table.
104
104
105
105
| Column name| Column type| Description|
@@ -109,7 +109,7 @@ in-memory hash table.
109
109
| event| text| Name of wait event|
110
110
| count| text| Count of samples|
111
111
112
- pg_wait_sampling_reset_profile() function resets the profile.
112
+ ` pg_wait_sampling_reset_profile() ` function resets the profile.
113
113
114
114
The work of wait event statistics collector worker is controlled by following
115
115
GUCs.
@@ -121,7 +121,7 @@ GUCs.
121
121
| pg_wait_sampling.profile_period| int4| Period for profile sampling in milliseconds| 10|
122
122
| pg_wait_sampling.profile_pid| bool| Whether profile should be per pid| true|
123
123
124
- Ifpg \_ wait \_ sampling.profile \_ pid is set to false, sampling profile wouldn't be
124
+ If` pg_wait_sampling.profile_pid ` is set to false, sampling profile wouldn't be
125
125
collected in per-process manner. In this case the value of pid could would
126
126
be always zero and corresponding row contain samples among all the processes.
127
127
@@ -137,11 +137,11 @@ for list of possible wait events.
137
137
Contribution
138
138
------------
139
139
140
- Please, notice, thatpg \_ wait \_ sampling is still under development and while
140
+ Please, notice, that` pg_wait_sampling ` is still under development and while
141
141
it's stable and tested, it may contains some bugs. Don't hesitate to raise
142
142
[ issues at github] ( https://github.com/postgrespro/pg_wait_sampling/issues ) with
143
143
your bug reports.
144
144
145
- If you're lacking of some functionality inpg \_ wait \_ sampling and feeling power
145
+ If you're lacking of some functionality in` pg_wait_sampling ` and feeling power
146
146
to implement it then you're welcome to make pull requests.
147
147