Skip to content

Commit e63a976

Browse files
XofGabrielle Roth
authored andcommitted
Some cleanups.
1 parent 2a44006 commit e63a976

File tree

1 file changed

+3
-5
lines changed

1 file changed

+3
-5
lines changed

duplicate_indexes/duplicate_indexes.sql

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,10 @@
1-
SELECT ni.nspname AS "namepsace",
2-
ct.relname AS "table",
1+
SELECT ni.nspname || '.' || ct.relname AS "table",
32
ci.relname AS "dup index",
4-
i.indkey AS "dup index attributes",
53
pg_get_indexdef(i.indexrelid) AS "dup index definition",
6-
ii.indkey AS "enc index attributes",
4+
i.indkey AS "dup index attributes",
75
cii.relname AS "encompassing index",
86
pg_get_indexdef(ii.indexrelid) AS "encompassing index definition"
7+
ii.indkey AS "enc index attributes",
98
FROM pg_index i
109
JOIN pg_class ct ON i.indrelid=ct.oid
1110
JOIN pg_class ci ON i.indexrelid=ci.oid
@@ -20,7 +19,6 @@ SELECT ni.nspname AS "namepsace",
2019
CASE WHEN i.indisunique THEN ii.indisunique ELSE true END
2120
JOIN pg_class ctii ON ii.indrelid=ctii.oid
2221
JOIN pg_class cii ON ii.indexrelid=cii.oid
23-
JOIN pg_namespace nii ON cii.relnamespace=nii.oid
2422
WHERE ct.relname NOT LIKE 'pg_%' AND
2523
NOT i.indisprimary
2624
ORDER BY 1, 2, 3

0 commit comments

Comments
 (0)