From: Nathan Bossart <nathandbossart@gmail.com>
To: Tom Lane <tgl@sss.pgh.pa.us>
Cc: Michael Paquier <michael@paquier.xyz>
Cc: Euler Taveira <euler@eulerto.com>
Cc: pgsql-hackers <pgsql-hackers@postgresql.org>
Subject: Re: improve performance of pg_dump with many sequences
Date: Wed, 7 Jan 2026 17:06:22 -0600
Message-ID: <aV7m7rTty4KAb-tF@nathan> (raw)
In-Reply-To: <2885944.1767029161@sss.pgh.pa.us>
References: <3578088.1721242766@sss.pgh.pa.us>
<ZpgV32NTM0ADvJop@nathan>
<3585715.1721243507@sss.pgh.pa.us>
<ZpiP3I6UVcgsCCWf@nathan>
<3640163.1721275101@sss.pgh.pa.us>
<ZpldUoP0XjHszExF@nathan>
<Zpl7HywbF2qAkTVf@nathan>
<ZqFJspSbieuTE4X0@nathan>
<ZqpV5Sb7YWauwYnx@nathan>
<2885944.1767029161@sss.pgh.pa.us>
I'm still looking into this, but here are some preliminary thoughts.
On Mon, Dec 29, 2025 at 12:26:01PM -0500, Tom Lane wrote:
> In the no-good-deed-goes-unpunished department: pg_dump's use
> of pg_get_sequence_data() (nee pg_sequence_read_tuple()) is
> evidently responsible for the complaint in bug #19365 [1]
> that pg_dump can no longer survive concurrent sequence drops.
This seems to be reproducible on older versions. With a well-timed sleep
right before dumpSequenceData()'s pre-v18 query, I can produce a
relation-does-not-exist error with a concurrent sequence drop. Perhaps v18
made this easier to reach, but given it moved the sequence tuple access to
collectSequences()'s query, I'm not sure why that would be.
> BTW, I'm unconvinced that pg_dump behaves sanely when this function
> does return nulls. I think the ideal thing would be for it to skip
> issuing setval(), but right now it looks like it will issue one with
> garbage values.
Before v18, pg_dump just ERRORs due to insufficient privileges on a
sequence. IMHO that makes sense. If you ask pg_dump to dump something you
don't have privileges on, I'd expect it to error instead of silently
skipping it.
--
nathan
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 using the --to and --cc options:
reply via email
To: pgsql-hackers@postgresql.org
Cc: nathandbossart@gmail.com, tgl@sss.pgh.pa.us, michael@paquier.xyz, euler@eulerto.com
Subject: Re: improve performance of pg_dump with many sequences
In-Reply-To: <aV7m7rTty4KAb-tF@nathan>
* 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