Query choosing Bad Index Path (ASC/DESC ordering).

2022-02-07 Thread Valli Annamalai
Postgres version: 11.4 Problem: Query choosing Bad Index Path (ASC/DESC ordering). Details are provided below Table: \d public.distdbentityauditlog1_46625_temp_mahi3; Table "public.distdbentityauditlog1_46625_temp_mahi3" Column |Type | Collation |

Re: slow "select count(*) from information_schema.tables;" in some cases

2022-02-07 Thread Imre Samu
Hi Lars, > psql (14.1, server 12.6 (Ubuntu 12.6-0ubuntu0.20.04.1)) Maybe you can upgrade to 12.9 ( from 12.6 ) ( https://www.postgresql.org/docs/release/12.9/ ) And the next minor release = pg 12.10 is expected on February 10th, 2022 https://www.postgresql.org/developer/roadmap/ As I see - o

Re: slow "select count(*) from information_schema.tables;" in some cases

2022-02-07 Thread Lars Aksel Opsahl
>From: Tom Lane >Sent: Monday, February 7, 2022 8:02 PM >To: Lars Aksel Opsahl >Cc: Vijaykumar Jain ; Pgsql Performance > >Subject: Re: slow "select count(*) from information_schema.tables;" in some >cases > >Lars Aksel Opsahl writes: >>> SELECT relname, pg_size_pretty(pg_relation_size

Re: slow "select count(*) from information_schema.tables;" in some cases

2022-02-07 Thread Tom Lane
Lars Aksel Opsahl 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

Re: slow "select count(*) from information_schema.tables;" in some cases

2022-02-07 Thread Lars Aksel Opsahl
>Vijaykumar Jain >Mon 2/7/2022 6:49 PM > >On Mon, Feb 7, 2022, 10:26 PM Lars Aksel Opsahl wrote: >Hi > Hi >Can you share the output of the below query? > >From the past threads I have learnt that too many templates objects may add to >bloat of system catalogs and may in start resultin

Re: slow "select count(*) from information_schema.tables;" in some cases

2022-02-07 Thread Vijaykumar Jain
On Mon, Feb 7, 2022, 10:26 PM Lars Aksel Opsahl wrote: > Hi > > Sometimes simple sql's like this takes a very long time "select count(*) from > information_schema.tables;" > > Other sql's not including system tables may work ok but login also takes a > very long time. > > The CPU load on the ser

Re: slow "select count(*) from information_schema.tables;" in some cases

2022-02-07 Thread Lars Aksel Opsahl
>> >> Here is a slow one: >> https://explain.depesz.com/s/tUt5 >> >> and here is fast one : >> https://explain.depesz.com/s/yYG4 > >The only difference is that this is sometimes many times slower. > > Finalize Aggregate (cost=42021.15..42021.16 rows=1 width=8) (actual > time=50602.755..1

Re: slow "select count(*) from information_schema.tables;" in some cases

2022-02-07 Thread Justin Pryzby
On Mon, Feb 07, 2022 at 04:56:35PM +, Lars Aksel Opsahl wrote: > Sometimes simple sql's like this takes a very long time "select count(*) > from information_schema.tables;" > > Other sql's not including system tables may work ok but login also takes a > very long time. > > The CPU load on

slow "select count(*) from information_schema.tables;" in some cases

2022-02-07 Thread Lars Aksel Opsahl
Hi Sometimes simple sql's like this takes a very long time "select count(*) from information_schema.tables;" Other sql's not including system tables may work ok but login also takes a very long time. The CPU load on the server is around 25%. There is no iowait. This happens typically when w