-
Notifications
You must be signed in to change notification settings - Fork 56
Expand file tree
/
Copy path0810-pg_table_size.yml
More file actions
27 lines (24 loc) · 1.45 KB
/
0810-pg_table_size.yml
File metadata and controls
27 lines (24 loc) · 1.45 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
#==============================================================#
# 0810 pg_table_size
#==============================================================#
pg_table_size:
desc: PostgreSQL table size metrics, quite slow
query: |-
SELECT CURRENT_CATALOG AS datname, nsp.nspname || '.' || rel.relname AS relname,
pg_total_relation_size(rel.oid) AS bytes,
pg_relation_size(rel.oid) AS relsize,
pg_indexes_size(rel.oid) AS indexsize,
pg_total_relation_size(reltoastrelid) AS toastsize
FROM pg_namespace nsp JOIN pg_class rel ON nsp.oid = rel.relnamespace
WHERE nspname <> ALL(ARRAY['pg_catalog', 'information_schema']) AND rel.relkind = 'r'
ORDER BY 3 DESC NULLS LAST LIMIT 256;
ttl: 300
timeout: 2
min_version: 100000
metrics:
- datname: { usage: LABEL ,description: "Database name of this table" }
- relname: { usage: LABEL ,description: "Schema qualified table name" }
- bytes: { usage: GAUGE ,default: 0 ,description: "Total bytes of this table (including toast, index, toast index)" }
- relsize: { usage: GAUGE ,default: 0 ,description: "Bytes of this table itself (main, vm, fsm)" }
- indexsize: { usage: GAUGE ,default: 0 ,description: "Bytes of all related indexes of this table" }
- toastsize: { usage: GAUGE ,default: 0 ,description: "Bytes of toast tables of this table" }