Skip to content

Commit edd45fa

Browse files
authored
PG-2312 - Reorganize Docker installation instructions (#957)
This PR updates and reorganizes the instructions and content in docker.md for easier flow and user readability.
1 parent a0e13a6 commit edd45fa

8 files changed

Lines changed: 406 additions & 256 deletions

File tree

docs/docker.md

Lines changed: 0 additions & 248 deletions
This file was deleted.
Lines changed: 98 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,98 @@
1+
# Enable `pg_stat_monitor` for performance statistics
2+
3+
`pg_stat_monitor` is a query performance monitoring tool for PostgreSQL which aggregates collected performance statistics.
4+
5+
For more information on this extension, see [pg_stat_monitor :octicons-link-external-16:](https://docs.percona.com/pg-stat-monitor/).
6+
7+
## Enable pg_stat_monitor {.power-number}
8+
9+
1. Start the container as shown in [Run in Docker](docker.md#start-container), adding the following option to the `docker run` command:
10+
11+
```{.bash data-prompt="$"}
12+
-c shared_preload_libraries=pg_stat_monitor
13+
```
14+
15+
2. Connect to the container and start the interactive `psql` session:
16+
17+
```{.bash data-prompt="$"}
18+
docker exec -it container-name psql -U postgres
19+
```
20+
21+
??? example "Sample output"
22+
23+
```{.text .no-copy}
24+
psql ({{pgsubversion}} - Percona Server for PostgreSQL {{dockertag}})
25+
Type "help" for help.
26+
27+
postgres=#
28+
```
29+
30+
3. Create the extension in the desired database:
31+
32+
```sql
33+
CREATE EXTENSION pg_stat_monitor;
34+
```
35+
36+
??? example "Sample output"
37+
38+
```{.text .no-copy}
39+
postgres=# CREATE EXTENSION pg_stat_monitor;
40+
CREATE EXTENSION
41+
```
42+
43+
4. Verify the setup:
44+
45+
```sql
46+
\d pg_stat_monitor;
47+
```
48+
49+
??? example "Output"
50+
51+
```
52+
View "public.pg_stat_monitor"
53+
Column | Type | Collation | Nullable | Default
54+
---------------------+--------------------------+-----------+----------+---------
55+
bucket | integer | | |
56+
bucket_start_time | timestamp with time zone | | |
57+
userid | oid | | |
58+
dbid | oid | | |
59+
queryid | text | | |
60+
query | text | | |
61+
plan_calls | bigint | | |
62+
plan_total_time | numeric | | |
63+
plan_min_timei | numeric | | |
64+
plan_max_time | numeric | | |
65+
plan_mean_time | numeric | | |
66+
plan_stddev_time | numeric | | |
67+
plan_rows | bigint | | |
68+
calls | bigint | | |
69+
total_time | numeric | | |
70+
min_time | numeric | | |
71+
max_time | numeric | | |
72+
mean_time | numeric | | |
73+
stddev_time | numeric | | |
74+
rows | bigint | | |
75+
shared_blks_hit | bigint | | |
76+
shared_blks_read | bigint | | |
77+
shared_blks_dirtied | bigint | | |
78+
shared_blks_written | bigint | | |
79+
local_blks_hit | bigint | | |
80+
local_blks_read | bigint | | |
81+
local_blks_dirtied | bigint | | |
82+
local_blks_written | bigint | | |
83+
temp_blks_read | bigint | | |
84+
temp_blks_written | bigint | | |
85+
blk_read_time | double precision | | |
86+
blk_write_time | double precision | | |
87+
host | bigint | | |
88+
client_ip | inet | | |
89+
resp_calls | text[] | | |
90+
cpu_user_time | double precision | | |
91+
cpu_sys_time | double precision | | |
92+
tables_names | text[] | | |
93+
wait_event | text | | |
94+
wait_event_type | text | | |
95+
```
96+
97+
!!! note
98+
The `pg_stat_monitor` view is available only for the databases where you enabled it. If you create a new database, make sure to create the view for it to see its statistics data.

0 commit comments

Comments
 (0)