pgsql: pg_dump: minor performance improvements from eliminating sub-SEL - Mailing list pgsql-committers

From Tom Lane
Subject pgsql: pg_dump: minor performance improvements from eliminating sub-SEL
Date
Msg-id E1n3KwJ-0000Wk-5h@gemulon.postgresql.org
Whole thread Raw
List pgsql-committers
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(-)


pgsql-committers by date:

Previous
From: Andres Freund
Date:
Subject: pgsql: ci: Add continuous integration for github repositories via cirru
Next
From: Tom Lane
Date:
Subject: pgsql: pg_dump: avoid unsafe function calls in getPolicies().