From: Vincent Le Gallic Date: Fri, 12 Feb 2016 00:23:56 +0000 (+0100) Subject: Hint SQL sur comment trouver la taille qu'occupent les INDEX X-Git-Url: http://gitweb.pimeys.fr/?p=scripts-20-100.git;a=commitdiff_plain;h=27811772f099914eeab61d107f9d1c65dc03837c Hint SQL sur comment trouver la taille qu'occupent les INDEX --- diff --git a/pg_size_of_indexes.sql b/pg_size_of_indexes.sql new file mode 100644 index 0000000..5b9ed44 --- /dev/null +++ b/pg_size_of_indexes.sql @@ -0,0 +1,8 @@ +SELECT nspname || '.' || relname AS "relation", + pg_size_pretty(pg_total_relation_size(C.oid)) AS "total_size" + FROM pg_class C + LEFT JOIN pg_namespace N ON (N.oid = C.relnamespace) + WHERE nspname NOT IN ('pg_catalog', 'information_schema') + AND C.relkind = 'i' + AND nspname !~ '^pg_toast' + ORDER BY pg_total_relation_size(C.oid) DESC;