More pg_dump performance hacking

Tom Lane <tgl@sss.pgh.pa.us>

From: Tom Lane <tgl@sss.pgh.pa.us>
To: pgsql-hackers@lists.postgresql.org
Date: 2021-12-30T22:28:38Z
Lists: pgsql-hackers

Attachments

Attached are a couple of patches for loose ends that I didn't
get to when I was working on pg_dump before the last CF.

0001 removes all the "username_subquery" subqueries in favor
of doing local username lookups.  On the regression database
with no extra roles, it seems to be more or less a wash ...
but if I create 100 roles, then the patch seems to save five
or ten percent compared to HEAD.

I also got rid of the rather-pointless-IMO checks for pg_authid
join failures, in favor of having the lookup subroutine just
fatal() if it doesn't find a match.  I don't think we need to
burden translators with all those strings for cases that shouldn't
happen.  Note that a lot of object types weren't checking
for this condition anyway, making it even more pointless.

0002 is a very small patch that gets rid of an extra subquery
for identity-sequence checking, realizing that the LEFT JOIN
in the FROM clause will have picked up that row already,
if it exists.  This again saves a few percent for
"pg_dump -s regression", though the effects would depend a lot
on how many sequences you have.

These don't seem complicated enough to require real review,
so I plan to just push them, unless there are objections.

			regards, tom lane

Commits

  1. pg_dump: minor performance improvements from eliminating sub-SELECTs.