Advertisement
Guest User

Untitled

a guest
May 29th, 2015
192
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.59 KB | None | 0 0
  1. select
  2. t.relname as table_name,
  3. i.relname as index_name,
  4. a.attname as column_name,
  5. pg_size_pretty(pg_relation_size(i.relname::regclass)) as index_size,
  6. st.null_frac as null_frac
  7. from
  8. pg_class t,
  9. pg_class i,
  10. pg_index ix,
  11. pg_attribute a,
  12. pg_stats st
  13. where
  14. t.oid = ix.indrelid
  15. and i.oid = ix.indexrelid
  16. and a.attrelid = t.oid
  17. and st.tablename = t.relname
  18. and st.attname = a.attname
  19. and a.attnum = ANY(ix.indkey)
  20. and t.relkind = 'r'
  21. and st.null_frac > 0.5
  22. and st.schemaname = current_schema
  23. order by
  24. t.relname,
  25. i.relname;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement