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: pg_dump: minor performance improvements from eliminating sub-SEL
Date: Fri, 31 Dec 2021 16:39:35 +0000
Message-ID: <E1n3KwJ-0000Wk-5h@gemulon.postgresql.org> (raw)

pg_dump: minor performance improvements from eliminating sub-SELECTs.

Get rid of the "username_subquery" mechanism in favor of doing
local lookups of role names from role OIDs.  The PG backend isn't
terribly smart about scalar SubLinks in SELECT output lists,
so this offers a small performance improvement, at least in
installations with more than a couple of users.  In any case
the old method didn't make for particularly readable SQL code.

While at it, I removed the various custom warning messages about
failing to find an object's owner, in favor of just fatal'ing
in the local lookup function.  AFAIK there is no reason any
longer to treat that as anything but a catalog-corruption case,
and certainly no reason to make translators deal with a dozen
different messages where one would do.  (If it turns out that
fatal() is indeed a bad idea, we can back off to issuing
pg_log_warning() and returning an empty string, resulting in
the same behavior as before, except more consistent.)

Also drop an entirely unnecessary sub-SELECT to check on the
pg_depend status of a sequence relation: we already have a
LEFT JOIN to fetch the row of interest in the FROM clause.

Discussion: https://postgr.es/m/2460369.1640903318@sss.pgh.pa.us

Branch
------
master

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

Modified Files
--------------
src/bin/pg_dump/pg_dump.c | 389 +++++++++++++++++++++++-----------------------
src/bin/pg_dump/pg_dump.h |  42 ++---
2 files changed, 217 insertions(+), 214 deletions(-)



Message-ID: <E1n3KwJ-0000Wk-5h@gemulon.postgresql.org>
Permalink:  ../E1n3KwJ-0000Wk-5h@gemulon.postgresql.org/
Also on:    postgresql.org/message-id/E1n3KwJ-0000Wk-5h@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: pg_dump: minor performance improvements from eliminating sub-SEL
  In-Reply-To: <E1n3KwJ-0000Wk-5h@gemulon.postgresql.org>
  References: <E1n3KwJ-0000Wk-5h@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