-
Notifications
You must be signed in to change notification settings - Fork 46
/
Copy path710-pg_index.yml
92 lines (88 loc) · 3.42 KB
/
710-pg_index.yml
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
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
##
# SYNOPSIS
# pg_index_*
#
# DESCRIPTION
# PostgreSQL index metrics
#
# OPTIONS
# Tags []
# TTL 10
# Priority 0
# Timeout 1s
# Fatal false
# Version 90400 ~ higher
# Source 710-pg_index.yml
#
# METRICS
# datname (LABEL)
# Database name of this index
# idxname (LABEL)
# Name of this index (full-qualifed schema name)
# relname (LABEL)
# Name of the table for this index (full-qualifed schema name)
# relid (LABEL)
# Relation oid of this index
# relpages (GAUGE)
# Size of the on-disk representation of this index in pages
# reltuples (GAUGE)
# Estimate relation tuples
# idx_scan (COUNTER)
# Number of index scans initiated on this index
# idx_tup_read (COUNTER)
# Number of index entries returned by scans on this index
# idx_tup_fetch (COUNTER)
# Number of live table rows fetched by simple index scans using this index
# idx_blks_read (COUNTER)
# Number of disk blocks read from this index
# idx_blks_hit (COUNTER)
# Number of buffer hits in this index
#
pg_index:
name: pg_index
desc: PostgreSQL index metrics
query: |
SELECT CURRENT_CATALOG AS datname, schemaname || '.' || indexrelname AS idxname, schemaname || '.' || relname AS relname ,indexrelid AS relid,
relpages, reltuples, idx_scan, idx_tup_read, idx_tup_fetch, idx_blks_read, idx_blks_hit
FROM pg_stat_user_indexes psui, LATERAL (SELECT idx_blks_read, idx_blks_hit FROM pg_statio_user_indexes psio WHERE psio.indexrelid = psui.indexrelid LIMIT 1) p2,
LATERAL (SELECT relpages,reltuples FROM pg_class c WHERE c.oid = psui.indexrelid LIMIT 1) p3
WHERE schemaname !~ '^pg_' AND schemaname !~ '^_' AND schemaname !~ '^timescaledb' AND schemaname !~ '^citus' AND schemaname !~ '^columnar' AND schemaname NOT IN ('pg_catalog','information_schema','pg_toast','repack','monitor')
ORDER BY idx_tup_read DESC LIMIT 512;
ttl: 10
timeout: 1
min_version: 090400
metrics:
- datname:
usage: LABEL
description: Database name of this index
- idxname:
usage: LABEL
description: Name of this index (full-qualifed schema name)
- relname:
usage: LABEL
description: Name of the table for this index (full-qualifed schema name)
- relid:
usage: LABEL
description: Relation oid of this index
- relpages:
usage: GAUGE
description: Size of the on-disk representation of this index in pages
# Size of the on-disk representation of this table in pages (of size BLCKSZ). This is only an estimate used by the planner. It is updated by VACUUM, ANALYZE, and a few DDL commands such as CREATE INDEX.
- reltuples:
usage: GAUGE
description: Estimate relation tuples
- idx_scan:
usage: COUNTER
description: Number of index scans initiated on this index
- idx_tup_read:
usage: COUNTER
description: Number of index entries returned by scans on this index
- idx_tup_fetch:
usage: COUNTER
description: Number of live table rows fetched by simple index scans using this index
- idx_blks_read:
usage: COUNTER
description: Number of disk blocks read from this index
- idx_blks_hit:
usage: COUNTER
description: Number of buffer hits in this index