Re: improve performance of pg_dump with many sequences

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

From: Tom Lane <tgl@sss.pgh.pa.us>
To: Nathan Bossart <nathandbossart@gmail.com>
Cc: Michael Paquier <michael@paquier.xyz>, Euler Taveira <euler@eulerto.com>, pgsql-hackers <pgsql-hackers@postgresql.org>
Date: 2026-01-08T00:24:52Z
Lists: pgsql-hackers
Nathan Bossart <nathandbossart@gmail.com> writes:
> On Wed, Jan 07, 2026 at 06:13:48PM -0500, Tom Lane wrote:
>> That would be a fine argument were it not that collectSequences()
>> tries to vacuum up the data for every sequence in the DB, whether
>> the user has asked to dump them all or not.

> I meant that we could teach pg_dump to error in dumpSequenceData() if it
> sees nulls for the sequence in question.

Ah, gotcha; I thought you were talking about changing
pg_get_sequence_data() to throw an error instead of returning nulls.

			regards, tom lane



Commits

  1. pg_dump: Fix gathering of sequence information.

  2. Improve performance of dumpSequence().

  3. Improve performance of dumpSequenceData().

  4. Introduce pg_sequence_read_tuple().

  5. Parse sequence type and integer metadata in dumpSequence().