pg.ddx.io  pgsql-performance@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: Lars Aksel Opsahl <Lars.Opsahl@nibio.no>
Cc: Vijaykumar Jain <vijaykumarjain.github@gmail.com>
Cc: Pgsql Performance <pgsql-performance@lists.postgresql.org>
Subject: Re: slow "select count(*) from information_schema.tables;" in some cases
Date: Mon, 07 Feb 2022 14:02:50 -0500
Message-ID: <1016661.1644260570@sss.pgh.pa.us> (raw)
In-Reply-To: <AM7P189MB10285F4025EA9299DD9C3DEA9D2C9@AM7P189MB1028.EURP189.PROD.OUTLOOK.COM>
References: <AM7P189MB1028F684ADED9D89722C85C19D2C9@AM7P189MB1028.EURP189.PROD.OUTLOOK.COM>
	<CAM+6J941cquhkv=8VJz19VqCTTscRzyL8Uj7DZ11VBjErwh4dQ@mail.gmail.com>
	<AM7P189MB10285F4025EA9299DD9C3DEA9D2C9@AM7P189MB1028.EURP189.PROD.OUTLOOK.COM>

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





view thread (9+ messages)  latest in thread

Message-ID: <1016661.1644260570@sss.pgh.pa.us>
Permalink:  ../1016661.1644260570@sss.pgh.pa.us/
Also on:    postgresql.org/message-id/1016661.1644260570@sss.pgh.pa.us

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-performance@postgresql.org
  Cc: tgl@sss.pgh.pa.us, Lars.Opsahl@nibio.no, vijaykumarjain.github@gmail.com, pgsql-performance@lists.postgresql.org
  Subject: Re: slow "select count(*) from information_schema.tables;" in some cases
  In-Reply-To: <1016661.1644260570@sss.pgh.pa.us>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox