11pg_stat_user_tables :
22 query : |
3- WITH server_version AS (
4- SELECT current_setting('server_version_num')::int AS ver
5- )
63 SELECT
74 current_database() datname,
85 schemaname,
@@ -25,13 +22,14 @@ pg_stat_user_tables:
2522 vacuum_count,
2623 autovacuum_count,
2724 analyze_count,
28- autoanalyze_count,
29- CASE WHEN server_version.ver >= 180000 THEN COALESCE(total_vacuum_time, 0) ELSE 0 END as total_vacuum_time,
30- CASE WHEN server_version.ver >= 180000 THEN COALESCE(total_autovacuum_time, 0) ELSE 0 END as total_autovacuum_time,
31- CASE WHEN server_version.ver >= 180000 THEN COALESCE(total_analyze_time, 0) ELSE 0 END as total_analyze_time,
32- CASE WHEN server_version.ver >= 180000 THEN COALESCE(total_autoanalyze_time, 0) ELSE 0 END as total_autoanalyze_time
25+ autoanalyze_count
26+ -- PostgreSQL 18+, cannot be added due backword compatibility: https://perconadev.atlassian.net/browse/PMM-14632
27+ -- total_vacuum_time,
28+ -- total_autovacuum_time,
29+ -- total_analyze_time,
30+ -- total_autoanalyze_time,
3331 FROM
34- pg_stat_user_tables, server_version
32+ pg_stat_user_tables
3533 metrics :
3634 - datname :
3735 usage : " LABEL"
@@ -99,18 +97,19 @@ pg_stat_user_tables:
9997 - autoanalyze_count :
10098 usage : " COUNTER"
10199 description : " Number of times this table has been analyzed by the autovacuum daemon"
102- - total_vacuum_time :
103- usage : " COUNTER"
104- description : " Time spent vacuuming this table, in milliseconds"
105- - total_autovacuum_time :
106- usage : " COUNTER"
107- description : " Time spent auto-vacuuming this table, in milliseconds"
108- - total_analyze_time :
109- usage : " COUNTER"
110- description : " Time spent analyzing this table, in milliseconds"
111- - total_autoanalyze_time :
112- usage : " COUNTER"
113- description : " Time spent auto-analyzing this table, in milliseconds"
100+ # PostgreSQL 18+, cannot be added due backword compatibility: https://perconadev.atlassian.net/browse/PMM-14632
101+ # - total_vacuum_time:
102+ # usage: "COUNTER"
103+ # description: "Time spent vacuuming this table, in milliseconds"
104+ # - total_autovacuum_time:
105+ # usage: "COUNTER"
106+ # description: "Time spent auto-vacuuming this table, in milliseconds"
107+ # - total_analyze_time:
108+ # usage: "COUNTER"
109+ # description: "Time spent analyzing this table, in milliseconds"
110+ # - total_autoanalyze_time:
111+ # usage: "COUNTER"
112+ # description: "Time spent auto-analyzing this table, in milliseconds"
114113
115114pg_statio_user_tables :
116115 query : " SELECT current_database() datname, schemaname, relname, heap_blks_read, heap_blks_hit, idx_blks_read, idx_blks_hit, toast_blks_read, toast_blks_hit, tidx_blks_read, tidx_blks_hit FROM pg_statio_user_tables"
0 commit comments