Largest index.
authorOleksandr Gavenko <gavenkoa@gmail.com>
Thu, 19 Sep 2019 09:10:33 +0300
changeset 2382 5f3c4cc21532
parent 2381 b26d26c54b05
child 2383 0c73cdddca3a
Largest index.
postgres.rst
--- a/postgres.rst	Wed Sep 18 09:29:55 2019 +0300
+++ b/postgres.rst	Thu Sep 19 09:10:33 2019 +0300
@@ -433,10 +433,19 @@
   where relkind = 'i'
   order by pg_relation_size(oid) desc;
 
+  select pg_relation_size(i.oid), t.relname as tname, i.relname as iname, *
+  from pg_class i
+  join pg_index ix on ix.indexrelid = i.oid
+  join pg_class t on t.oid = ix.indrelid
+  where i.relkind = 'i'
+  order by pg_relation_size(i.oid) desc;
+
 https://www.postgresql.org/docs/9.6/functions-admin.html
   Database Object Management Functions.
 https://wiki.postgresql.org/wiki/Disk_Usage
-   Finding the size of various object in your database.
+  Finding the size of various object in your database.
+https://wiki.postgresql.org/wiki/Index_Maintenance
+  Index size/usage statistics.
 
 MVCC and transaction id
 =======================