pg.ddx.io  pgsql-general@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Laurenz Albe <laurenz.albe@cybertec.at>
To: depesz@depesz.com, Tom Lane <tgl@sss.pgh.pa.us>
Cc: pgsql-general <pgsql-general@lists.postgresql.org>
Subject: Re: Can we get rid of repeated queries from pg_dump?
Date: Fri, 27 Aug 2021 09:33:51 +0200
Message-ID: <e6a7503afd115d111fbb96c5787906d73cfe2605.camel@cybertec.at> (raw)
In-Reply-To: <20210826160644.GA3120@depesz.com>
References: <20210826084430.GA26282@depesz.com>
	<648517.1629986527@sss.pgh.pa.us>
	<20210826140827.GA15868@depesz.com>
	<649446.1629987629@sss.pgh.pa.us>
	<20210826160644.GA3120@depesz.com>

On Thu, 2021-08-26 at 18:06 +0200, hubert depesz lubaczewski wrote:
> Now for query stats.
> 
> To dump it all, pg_dump needed 9173 queries (logged by
> log_min_duration_statement = 0 for this user).
> 
> I extracted all queries to separate files, and made stats. In total there were
> only 4257 unique queries.
> 
> Then I checked for repeated queries. Top 10 most repeated offenders were:
> 
> 615 times : SELECT pg_catalog.format_type('25'::pg_catalog.oid, NULL)
> 599 times : SELECT pg_catalog.format_type('23'::pg_catalog.oid, NULL)
> 579 times : SELECT pg_catalog.format_type('2281'::pg_catalog.oid, NULL)
> 578 times : SELECT pg_catalog.format_type('41946'::pg_catalog.oid, NULL)
> 523 times : SELECT pg_catalog.format_type('701'::pg_catalog.oid, NULL)
> 459 times : SELECT pg_catalog.format_type('42923'::pg_catalog.oid, NULL)
> 258 times : SELECT pg_catalog.format_type('16'::pg_catalog.oid, NULL)
> 176 times : SELECT pg_catalog.format_type('19'::pg_catalog.oid, NULL)
> 110 times : SELECT pg_catalog.format_type('21'::pg_catalog.oid, NULL)
> 106 times : SELECT pg_catalog.format_type('42604'::pg_catalog.oid, NULL)
> 
> In total, there were 5000 queries:
> SELECT pg_catalog.format_type('[0-9]+'::pg_catalog.oid, NULL)
> 
> But there were only 83 separate oids that were scanned.

That is a strong argument for using a hash table to cache the types.

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






view thread (37+ messages)  latest in thread

Message-ID: <e6a7503afd115d111fbb96c5787906d73cfe2605.camel@cybertec.at>
Permalink:  ../e6a7503afd115d111fbb96c5787906d73cfe2605.camel@cybertec.at/
Also on:    postgresql.org/message-id/e6a7503afd115d111fbb96c5787906d73cfe2605.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 using the --to and --cc options:
  reply via email

  To: pgsql-general@postgresql.org
  Cc: laurenz.albe@cybertec.at, tgl@sss.pgh.pa.us, pgsql-general@lists.postgresql.org
  Subject: Re: Can we get rid of repeated queries from pg_dump?
  In-Reply-To: <e6a7503afd115d111fbb96c5787906d73cfe2605.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