File tree 1 file changed +45
-0
lines changed 1 file changed +45
-0
lines changed Original file line number Diff line number Diff line change
1
+ -- Querying pg_wait_sampling_history after
2
+ -- enabling the extension
3
+
4
+ -- Views:
5
+ -- pg_wait_sampling_profile
6
+ -- pg_wait_sampling_history
7
+
8
+ SELECT * FROM pg_wait_sampling_history LIMIT 1 ;
9
+ -- pid
10
+ -- ts (timestamp)
11
+ -- event_type
12
+ -- event
13
+ -- queryid
14
+ --
15
+
16
+ -- Wait events by process type (event_type)
17
+ -- Event types (Client, Activity)
18
+ -- Events: ClientRead, AutoVacuumMain
19
+ SELECT
20
+ pid,
21
+ event_type,
22
+ event,
23
+ count (* )
24
+ FROM
25
+ pg_wait_sampling_history
26
+ WHERE
27
+ ts > now() - interval ' 1 hour'
28
+ GROUP BY
29
+ pid,
30
+ event_type,
31
+ event
32
+ ORDER BY
33
+ count (* ) DESC ;
34
+
35
+
36
+ -- https://akorotkov.github.io/blog/2016/03/25/wait_monitoring_9_6/
37
+ -- For queries we probably care most about Lock (heavyweight), LWLock (lightweight)
38
+ -- For events buffer_content, transactionid
39
+
40
+
41
+ -- Default is 1s, can increase the sampling frequency
42
+ pg_wait_sampling .sample_interval = ' 10ms'
43
+
44
+ -- - Can change the history, default 100
45
+ pg_wait_sampling .history_size = 1000
You can’t perform that action at this time.
0 commit comments