pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: pgsql-committers@lists.postgresql.org
Subject: pgsql: Use PREPARE/EXECUTE for repetitive per-object queries in pg_dump
Date: Mon, 06 Dec 2021 18:23:20 +0000
Message-ID: <E1muIe0-0007N4-R4@gemulon.postgresql.org> (raw)

Use PREPARE/EXECUTE for repetitive per-object queries in pg_dump.

For objects such as functions, pg_dump issues the same secondary
data-collection query against each object to be dumped.  This can't
readily be refactored to avoid the repetitive queries, but we can
PREPARE these queries to reduce planning costs.

This patch applies the idea to functions, aggregates, operators, and
data types.  While it could be carried further, the remaining sorts of
objects aren't likely to appear in typical databases enough times to
be worth worrying over.  Moreover, doing the PREPARE is likely to be a
net loss if there aren't at least some dozens of objects to apply the
prepared query to.

Discussion: https://postgr.es/m/7d7eb6128f40401d81b3b7a898b6b4de@W2012-02.nidsa.loc

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/be85727a3df743a1f7e93b41dd7ac2b667e8ae04

Modified Files
--------------
src/bin/pg_dump/pg_backup.h |  20 +
src/bin/pg_dump/pg_dump.c   | 878 ++++++++++++++++++++++++++------------------
2 files changed, 532 insertions(+), 366 deletions(-)



Message-ID: <E1muIe0-0007N4-R4@gemulon.postgresql.org>
Permalink:  ../E1muIe0-0007N4-R4@gemulon.postgresql.org/
Also on:    postgresql.org/message-id/E1muIe0-0007N4-R4@gemulon.postgresql.org

 · 

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-committers@postgresql.org
  Cc: tgl@sss.pgh.pa.us
  Subject: Re: pgsql: Use PREPARE/EXECUTE for repetitive per-object queries in pg_dump
  In-Reply-To: <E1muIe0-0007N4-R4@gemulon.postgresql.org>
  References: <E1muIe0-0007N4-R4@gemulon.postgresql.org>

* 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