pg.ddx.io  pgsql-general@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Laurenz Albe <laurenz.albe@cybertec.at>
To: Matthias Apitz <guru@unixarea.de>
To: Postgres General <pgsql-general@postgresql.org>
Subject: Re: Mysterious performance degradation in exceptional cases
Date: Fri, 21 Oct 2022 16:14:56 +0200
Message-ID: <07ea822415c23f89fd3ba92856287089f80817a3.camel@cybertec.at> (raw)
In-Reply-To: <20221021074802.GA7@sh4-5.1blu.de>
References: <20220914083126.GA9@sh4-5.1blu.de>
	<20221021074802.GA7@sh4-5.1blu.de>

On Fri, 2022-10-21 at 09:48 +0200, Matthias Apitz wrote:
> > all this should not take longer than 1-2 seconds, and
> > normally it does not take longer. But, in some situations it takes
> > longer than 180 seconds, in 10% of the cases.
> 
> DBCEXIT|N|sisisinst|RDIR|4|21.10.2022 06:08:25:594
> DBCEXIT|N|adm_partab|RDIR|2|21.10.2022 06:08:25:597
> DBCEXIT|N|adm_partab|RDIR|1|21.10.2022 06:08:25:598
> DBCEXIT|N|adm_partab|RDIR|0|21.10.2022 06:08:25:599
> DBCEXIT|N|adm_partab|RDIR|0|21.10.2022 06:08:25:600
> DBCEXIT|N|adm_partab|RDIR|0|21.10.2022 06:08:25:601
> DBCEXIT|N|adm_partab|RDIR|0|21.10.2022 06:08:25:602
> DBCEXIT|N|d12termfkt|RWHR|1|21.10.2022 06:08:25:630
> DBCEXIT|N|d12termfkt|RWHR|2|21.10.2022 06:08:25:632
> DBCEXIT|N|d601biblpar|RALL|3|21.10.2022 06:08:25:636
> DBCEXIT|N|d06vw|RDIR|1|21.10.2022 06:08:25:637
> DBCEXIT|N|titel_worte|RDIR|13|21.10.2022 06:08:25:660
> DBCEXIT|N|titel_worte|FETCH|0|21.10.2022 06:08:25:660
> DBCEXIT|N|d14zweigsicht|RWHR|1|21.10.2022 06:08:25:662
> DBCEXIT|W|titel_daten|COUNT|183875|21.10.2022 06:11:29:538
>                             ^^^^^^
> 
> 'RDIR' means a SELECT with a key, ... 'COUNT' executes a 
> 
> SELECT count(*) from titel_daten
> 
> The 5th column gives the duration in/below the DBLAYER in milliseconds, in
> the above case 183875, i.e. 183 seconds. The table in question titel_daten
> has 5830370 rows. I did it right now with psql and it takes a second
> only:
> 
> sisis=# select count(*) from titel_daten;
>   count  
> ---------
>  5827383
> (1 row)
> 
> What could be a reason for 183 seconds, sometimes not always?

The most obvious idea is a lock with a statement that takes an ACCESS EXCLUSIVE
lock, like TRUNCATE or ALTER TABLE.

But there are other possibilities, like network problems or a problem
inside your application.

To narrow that down, set "log_min_duration_statement" and possibly activate
"auto_explain", so that you can verify if the long delay is due to long
processing time inside the database.

Yours,
Laurenz Albe
-- 
Cybertec | https://www.cybertec-postgresql.com





view thread (11+ messages)

Message-ID: <07ea822415c23f89fd3ba92856287089f80817a3.camel@cybertec.at>
Permalink:  ../07ea822415c23f89fd3ba92856287089f80817a3.camel@cybertec.at/
Also on:    postgresql.org/message-id/07ea822415c23f89fd3ba92856287089f80817a3.camel@cybertec.at

 · 

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 from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-general@postgresql.org
  Cc: laurenz.albe@cybertec.at, guru@unixarea.de
  Subject: Re: Mysterious performance degradation in exceptional cases
  In-Reply-To: <07ea822415c23f89fd3ba92856287089f80817a3.camel@cybertec.at>
  References: <20220914083126.GA9@sh4-5.1blu.de> <20221021074802.GA7@sh4-5.1blu.de> <07ea822415c23f89fd3ba92856287089f80817a3.camel@cybertec.at>

* 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