Skip to content

Commit ec2339a

Browse files
authored
[SDBM-2099] Fixes an issue querying table and index metrics on the public schema (DataDog#21686)
* Fixes an issue querying table and index metrics on the public schema * Add changelog
1 parent 48cb75b commit ec2339a

2 files changed

Lines changed: 10 additions & 5 deletions

File tree

postgres/changelog.d/21686.fixed

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Fixes an issue querying table and index relation metrics on the public schema

postgres/datadog_checks/postgres/relationsmanager.py

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@
6767
'query': """
6868
SELECT
6969
current_database(),
70-
schemaname,
70+
nspname,
7171
relname,
7272
indexrelname,
7373
is_valid,
@@ -78,7 +78,7 @@
7878
idx_blks_hit,
7979
index_size
8080
FROM (SELECT
81-
N.nspname AS schemaname,
81+
N.nspname AS nspname,
8282
C.relname AS relname,
8383
I.relname AS indexrelname,
8484
X.indisvalid::text AS is_valid,
@@ -137,16 +137,20 @@
137137
'name': 'pg_class_size',
138138
'query': """
139139
SELECT current_database(),
140-
s.schemaname, s.table, s.partition_of,
141-
s.relpages, s.reltuples, s.relallvisible,
140+
s.nspname,
141+
s.table,
142+
s.partition_of,
143+
s.relpages,
144+
s.reltuples,
145+
s.relallvisible,
142146
s.relation_size + s.toast_size,
143147
s.relation_size,
144148
s.index_size,
145149
s.toast_size,
146150
s.relation_size + s.index_size + s.toast_size
147151
FROM
148152
(SELECT
149-
N.nspname as schemaname,
153+
N.nspname as nspname,
150154
relname as table,
151155
I.inhparent::regclass AS partition_of,
152156
C.relpages, C.reltuples, C.relallvisible,

0 commit comments

Comments
 (0)