You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This is because attnum of indexes in pg_attribute table will not always match with indkey of index in pg_index table. It will usually match for primary key or initial columns. Thus, pg_attribute.attnum = ind_atts.attnum condition has to be removed.
This condition
pg_attribute.attnum = ind_atts.attnum
is filtering out majority of the bloated indexes.Ref - JOIN btree_index_atts AS ind_atts ON pg_attribute.attrelid = ind_atts.indexrelid AND pg_attribute.attnum = ind_atts.attnum
This is because attnum of indexes in
pg_attribute
table will not always match with indkey of index inpg_index
table. It will usually match for primary key or initial columns. Thus,pg_attribute.attnum = ind_atts.attnum
condition has to be removed.This condition : pg_stats.attname = pg_catalog.pg_get_indexdef(pg_attribute.attrelid, pg_attribute.attnum, TRUE) while joining with
pg_stats
will take care of the rest.The text was updated successfully, but these errors were encountered: