Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 5196ffb

Browse files
authored
duplicate indexes
1 parent d0d88e6 commit 5196ffb

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

‎TODO.md‎

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -311,3 +311,17 @@ $$;
311311
# gender_by_name
312312

313313
http://ceur-ws.org/Vol-2754/paper3.pdf
314+
315+
# duplicate indexes
316+
317+
```sql
318+
SELECT pg_size_pretty(sum(pg_relation_size(idx))::bigint) AS size,
319+
(array_agg(idx))[1] AS idx1, (array_agg(idx))[2] AS idx2,
320+
(array_agg(idx))[3] AS idx3, (array_agg(idx))[4] AS idx4
321+
FROM (
322+
SELECT indexrelid::regclass AS idx, (indrelid::text ||E'\n'|| indclass::text ||E'\n'|| indkey::text ||E'\n'||
323+
coalesce(indexprs::text,'')||E'\n' || coalesce(indpred::text,'')) AS KEY
324+
FROM pg_index) sub
325+
GROUP BY KEY HAVING count(*)>1
326+
ORDER BY sum(pg_relation_size(idx)) DESC;
327+
```

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /