Re: slow "select count(*) from information_schema.tables;" in some cases - Mailing list pgsql-performance

From Tom Lane
Subject Re: slow "select count(*) from information_schema.tables;" in some cases
Date
Msg-id 1016661.1644260570@sss.pgh.pa.us
Whole thread Raw
In response to Re: slow "select count(*) from information_schema.tables;" in some cases  (Lars Aksel Opsahl <Lars.Opsahl@nibio.no>)
Responses Re: slow "select count(*) from information_schema.tables;" in some cases  (Lars Aksel Opsahl <Lars.Opsahl@nibio.no>)
List pgsql-performance
Lars Aksel Opsahl <Lars.Opsahl@nibio.no> writes:
>> SELECT relname, pg_size_pretty(pg_relation_size(C.oid)) FROM pg_class C LEFT JOIN pg_namespace N ON (N.oid =
C.relnamespace)WHERE nspname = 'pg_catalog' ORDER BY 2 DESC LIMIT 20; can you show the output of this query 

"ORDER BY 2" is giving you a textual sort of the sizes, which is entirely
unhelpful.  Try

SELECT relname, pg_size_pretty(pg_relation_size(C.oid)) FROM pg_class C LEFT JOIN pg_namespace N ON (N.oid =
C.relnamespace)WHERE nspname = 'pg_catalog' ORDER BY pg_relation_size(C.oid) DESC LIMIT 20; 

            regards, tom lane



pgsql-performance by date:

Previous
From: Lars Aksel Opsahl
Date:
Subject: Re: slow "select count(*) from information_schema.tables;" in some cases
Next
From: Lars Aksel Opsahl
Date:
Subject: Re: slow "select count(*) from information_schema.tables;" in some cases