We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 95f78a2 commit 4b68987Copy full SHA for 4b68987
indexes/duplicate_indexes.sql
@@ -0,0 +1,21 @@
1
+
2
+\o /tmp/duplicate-indexes.txt
3
4
+-- check for exact matches
5
+SELECT indrelid::regclass
6
+ , array_agg(indexrelid::regclass)
7
+ FROM pg_index
8
+ GROUP BY indrelid
9
+ , indkey
10
+HAVING COUNT(*) > 1;
11
12
+-- check for matches on only the first column of the index
13
+-- requires some human eyeballing to verify
14
15
16
17
18
+ , indkey[0]
19
20
21
+\o
0 commit comments