Advertisement
jconroy

DB Index Size report

Apr 1st, 2025
582
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. SELECT
  2.     i.schemaname AS schema_name,
  3.     i.tablename AS table_name,
  4.     i.indexname AS index_name,
  5.     pg_size_pretty(pg_relation_size(quote_ident(i.schemaname) || '.' || quote_ident(i.indexname))) AS index_size,
  6.     pg_size_pretty(pg_total_relation_size(quote_ident(i.schemaname) || '.' || quote_ident(i.tablename))) AS table_total_size,
  7.     pg_relation_size(quote_ident(i.schemaname) || '.' || quote_ident(i.indexname)) AS index_size_bytes,
  8.     i.indexdef
  9. FROM
  10.     pg_indexes i
  11. ORDER BY
  12.     pg_relation_size(quote_ident(i.schemaname) || '.' || quote_ident(i.indexname)) DESC;
Tags: sql SIZE indexes
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement