Skip to content

Instantly share code, notes, and snippets.

View ngzax's full-sized avatar
😎
delivering!

Daryl Richter ngzax

😎
delivering!
View GitHub Profile
@ngzax
ngzax / index_dupes.sql
Last active August 29, 2015 14:06 — forked from jberkus/gist:e4cadd6b8877c3bc59c8
Finds duplicate indexes on a PostgreSQL DB
-- check for exact matches
WITH index_cols_ord as (
SELECT attrelid, attnum, attname
FROM pg_attribute
JOIN pg_index ON indexrelid = attrelid
WHERE indkey[0] > 0
ORDER BY attrelid, attnum
),
index_col_list AS (
SELECT attrelid,