Skip to content

Instantly share code, notes, and snippets.

@jkburges
Last active August 29, 2015 14:20
Show Gist options
  • Save jkburges/06c0b369b3822142ff26 to your computer and use it in GitHub Desktop.
Save jkburges/06c0b369b3822142ff26 to your computer and use it in GitHub Desktop.
Index sizes
Separate indexes:
"aatams.detection";"16 GB"
"aatams.detection_transmitter_id_index";"4882 MB"
"aatams.detection_receiver_name_index";"4877 MB"
"aatams.detection_timestamp_index";"4706 MB"
"aatams.detection_pkey";"4055 MB"
"aatams.detection_receiver_download_id_index";"3507 MB"
@jkburges
Copy link
Author

SELECT nspname || '.' || relname AS "relation",
    pg_size_pretty(pg_relation_size(C.oid)) AS "size"
  FROM pg_class C
  LEFT JOIN pg_namespace N ON (N.oid = C.relnamespace)
  WHERE nspname NOT IN ('pg_catalog', 'information_schema')
  AND relname like 'detection%'
  ORDER BY pg_relation_size(C.oid) DESC
  LIMIT 20;

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment