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