Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1vdcbm-002rnU-21 for pgsql-hackers@arkaria.postgresql.org; Wed, 07 Jan 2026 23:06:31 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.96) (envelope-from ) id 1vdcbl-00G3s8-1r for pgsql-hackers@arkaria.postgresql.org; Wed, 07 Jan 2026 23:06:30 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1vdcbl-00G3s0-0q for pgsql-hackers@lists.postgresql.org; Wed, 07 Jan 2026 23:06:30 +0000 Received: from mail-oa1-x2c.google.com ([2001:4860:4864:20::2c]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.96) (envelope-from ) id 1vdcbj-005AEC-2P for pgsql-hackers@postgresql.org; Wed, 07 Jan 2026 23:06:29 +0000 Received: by mail-oa1-x2c.google.com with SMTP id 586e51a60fabf-3ec46e3c65bso1987685fac.0 for ; Wed, 07 Jan 2026 15:06:27 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1767827186; x=1768431986; darn=postgresql.org; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:from:to:cc:subject:date:message-id:reply-to; bh=BM//r4qCqTA/WIBI6LJqIUmmvWoemnm6BjrEmENdw3M=; b=Qe1w8Vd/uiPyFPZKf0KXfrc4Jtg+5T9ByMCdVp1kafRq9UKy96uXW6MiKkCqDq3zTs tKYvXX+Nc5MgKcykZcs4XGqE/HYPhpcNmXXhivgtva07IeuA3QGCiG1rLiJ8+eEnsoZz E0J/oK2gvD5TpX7WcLB2A32P6U34nFx+Asr/QZTCVsDoyivaudM9OK2YWnu3qSK7Feam 3SXmI4lDAtKeiQsWHmysZNdYhMdhNXBBtUlc4jZFfhLpkiutQA7imBc/5mdKWFFT7kVK rm3+5gTZIfTeOFfvOv0FBOKIaVyuaVDfIyNlg2UcG2disQER0gxPu+W0QUv1sep1MgXZ nCaw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1767827186; x=1768431986; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-gg:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=BM//r4qCqTA/WIBI6LJqIUmmvWoemnm6BjrEmENdw3M=; b=jAm0XzGE24H9C863eQLkYqVk0JiyN5qT1KyrGlkFp2ar0cPckIHGxvhmZobZqMZzpG g18Rpo/gMw6DSMtCz4eJO5V6NoSqE/3ER0BBRKX1Jdfh40old3kUrN4t5MMe53C4Uggq mYZ8I0/uZxltPCOpx9tU6bNjxvrjOaOwdAKGP5Q4uH4Ay2hbhCh82IxHqRRpu5dBDUjV 3A9qSXfZwmPxUIz5CnYKvDj22afMIytE+sXlkrL1yjV7n2byyKkiXmOKmWB+ng4ROr35 wF8On/GR8iukkY2XjNUUCybZgBDBIPLEPu20L1eu9XbspgIY00BNqBHZm2weYTtP2mEv RF2g== X-Forwarded-Encrypted: i=1; AJvYcCWJh61iLvWWGPqFT53lht9kVAW7XqiE7UMDlyGpTkYGM09fkU6CZReArFbrNlOrCZeM3JfioQLmlhUTD6To@postgresql.org X-Gm-Message-State: AOJu0Yz4/UXt3SyrrKQpFSXpkR0cZ0RJjQ89aWReNXR65w5ZfXMALIz4 e70ULVZWcx0XAgVTp8rYN65pYHlJwS4SoTWrybXMEY8hPqLjuOGDvdeV X-Gm-Gg: AY/fxX6xYH+8hhw/sacMxuReD23yyVU6J5Yefygg95yzBzpshloRNexSvojHNNYRWp2 iCOk2HZcwN7yMmgWIsx5U5Cf7snjiZn/4iigrGWnS601FZtXzNWV59h9qjRD7ZEmg/96kSlsApL Vlh9gL134KD1hG0TaVliRNMDLxw0M4kh60Dvs8Gdsx7XMMl/5jHiD84T+RUv20yN+CCbmVhvvSB zOJY3d0qeSlIR8VKTAMypgL2VYveeQmg71vBvpPKyBTqmpxFj5JqJxr4UHy8fcHnTj8fe9lBFaz fgV2IWkTR1tBPHdzvIjTDSnuaNUOB1FM3IquEdkWnWZe3S4oJfjCNczaAkB3X0GALcDVoXR6vlH eUOoZNks5iz2nVCzIfnpF1yAR213pJU1uajPBRKyV3CzM7LS6cI0XJ4POiiE/IAB+NsStlRGS4K vVV4Jxzglk/+Cw0iYZJFno2dRwVRBDYoQ7B/zoE1JJuVhP4ovjTluwrI6X4m3EvNKlWiKs7t3lq RyU X-Google-Smtp-Source: AGHT+IHJuK0NxXI9ftFMe/2UstN90MZnSbgctjNDJ90pDyBnIcOKNeM0ZF3FhAnFtlJIBt+kWWp+ww== X-Received: by 2002:a05:6870:e12e:b0:31d:736d:ebdd with SMTP id 586e51a60fabf-3ffc09b5506mr1657915fac.13.1767827185877; Wed, 07 Jan 2026 15:06:25 -0800 (PST) Received: from nathan (162-195-170-173.lightspeed.stlsmo.sbcglobal.net. [162.195.170.173]) by smtp.gmail.com with ESMTPSA id 586e51a60fabf-3ffa4de8cbfsm4003911fac.3.2026.01.07.15.06.24 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 07 Jan 2026 15:06:24 -0800 (PST) Date: Wed, 7 Jan 2026 17:06:22 -0600 From: Nathan Bossart To: Tom Lane Cc: Michael Paquier , Euler Taveira , pgsql-hackers Subject: Re: improve performance of pg_dump with many sequences Message-ID: References: <3578088.1721242766@sss.pgh.pa.us> <3585715.1721243507@sss.pgh.pa.us> <3640163.1721275101@sss.pgh.pa.us> <2885944.1767029161@sss.pgh.pa.us> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <2885944.1767029161@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk 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