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 1vusJe-00Ameq-2G for pgsql-hackers@arkaria.postgresql.org; Tue, 24 Feb 2026 13:19:06 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.96) (envelope-from ) id 1vusJc-0016JH-0e for pgsql-hackers@arkaria.postgresql.org; Tue, 24 Feb 2026 13:19:04 +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 1vusJb-0016J8-2o for pgsql-hackers@lists.postgresql.org; Tue, 24 Feb 2026 13:19:03 +0000 Received: from mail-lj1-x229.google.com ([2a00:1450:4864:20::229]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.98.2) (envelope-from ) id 1vusJY-000000013gr-44nO for pgsql-hackers@lists.postgresql.org; Tue, 24 Feb 2026 13:19:03 +0000 Received: by mail-lj1-x229.google.com with SMTP id 38308e7fff4ca-388126f79bcso47019941fa.0 for ; Tue, 24 Feb 2026 05:19:01 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1771939140; cv=none; d=google.com; s=arc-20240605; b=aCNu497wpn1qwurPezeeONWMj9+Mqtmx00+BMleoG3XvbHOsUCKjaq4tL7zguWPJS1 VOs04u+TEcTAPEi7JW4i3UjHDOHXzW12gCZVftgczOX6FJMRUN/1Z9N/l8xFg1Q/xzGE JIiPd1hxywUnQMV7HC9oieflFbhXmZAYUG5CK6u2nR+7Na0vzCTWtqBvvE077+tkNH0F /NU6OvSO0OCYXBKjj8TqzMqpb0RBn9zeQR8NxWfeJXtllBNvNxk/CQWMzDqaVXP+yz6s BbyZ0dua9+PgzQD8TwZnPmPk3HQgAmhIL2d09oQQNbo0Tz+bhDCLzPtnZhHmvtMQCprF NNFQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=EAE4DQpmjb4C5SDvWJvUznkqpeqbOIUxe0M4QMlAnmI=; fh=6QfqFRpJb25m1r/mokCA+31lCoGku515LYLvZa/b0xA=; b=GXYRO1cg+AuyuPurO8p0hqEuaV3vD6rzSBvZqzvsU98cuGFUbWB8aaUyZpL5tyjRKl As4OKhiTTQCegAr1kbBisUIKPgsZJtflCfWJmWuTz1lTVEDQp7R7JatBKiAFjNoPzN6T l5MCMZcvDvpnEf+csNDZoxeUTuwcFfnMbuQ1mupfy/9ctKCIwGFa8ttpt6bSYL73P1B/ zYHhhsXFPfUF6D7VQ5vIrvEpp+AY7A2cjqjTXR5W+RqfQd9pfTa6JkztKm3QIZDAzfDT AfyJmE9W0zD2C5xBn7dLHdMIlAUXGBitARO/JKYJJ89c9O6QIasKjzifMhDjLOkg0MAw ZRgw==; darn=lists.postgresql.org ARC-Authentication-Results: i=1; mx.google.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1771939140; x=1772543940; darn=lists.postgresql.org; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=EAE4DQpmjb4C5SDvWJvUznkqpeqbOIUxe0M4QMlAnmI=; b=WutFEMvD8FDaZh6ifgexfrIV/i0yjs8gLXejtodfyQpzb1T3nhn/l+2Z3YgsvZe6R7 4CLEOeDrbAGq39V6yyC71wVBPXaHY4tU3nZFKCaFrVgBz1kB3s8hsX9EdkzTPfkizfM0 3ZO6YEPmSZQX80RykXpSf/HJ8Wz+yq7zn3wdTT73qVctESoEYP0xqBf6odRIchUOoFsj Opb4l+iICSFFRYWXEkWCNdLlhBZRqjsNrLlEHRT88F4WEOmjHUY32cZLpjIk1PEeFyZ4 dhuNuH4RT67jnfzDq2j5MAhMJ48uYfoOJLqUkskvWF7g5qalqJvZtOQ/VCFRW2bpCMGN aUKQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1771939140; x=1772543940; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=EAE4DQpmjb4C5SDvWJvUznkqpeqbOIUxe0M4QMlAnmI=; b=LFVZbvuEnMEhr1uhPuMJmOkoayTbWcbGmdaW3ubqWMWmOPWRLYREkBGD+58xMcaavH NVxw6Bc3wxeU1a8cIdhZiV/t5v66FA4ab0QtGOTZDOepHo3vtc9fvgLdpD4EEnD+q3+s uXxW4j01lOzr+JoWbwOdkPAZ8Y2obv13Cpv3X8021fDf0MgKeE3j6+XS1MV+r8qmWWsj gg6ESbzcIYFiibq40NDa13aiatl7eOlIr5wdfeR6lSAd+O/0OE1e3qK6FRDnCeQmwGuT VpEuA3G23WehA0RKV7Kw/EGzJaPUFVMqwLlNFwrnhia9IH0ShIqNoqfZ4zaG2eM4NLs1 hB7w== X-Forwarded-Encrypted: i=1; AJvYcCUTjQZnn2AWQTgOxgspTC2JpDMaNSptYJD0i5xPtsa/9SCABDqw9YcuZKgVLTY5MGYXfE2LkaM2Kp/gUNau@lists.postgresql.org X-Gm-Message-State: AOJu0YxWrUpd7BbRxUkzdRkh4/CvhhCB8goyre6oLiLDYBxwwOhcDntA 0vzY42feWjhBjYl2QSnlz2yWJlu85xEOTV0nVyKwZeoltebl5+x1QhFNr4+MgV3kaFKcdRg+5Z5 tzZIFge3qUa7DxpNCFh6p9eY5hUb+/q4= X-Gm-Gg: ATEYQzxp9qEvd+o0wSEeOuxMrfU5c9eyNtLrS4mstz1MKupya/bo+oTNVvK9DSZBQW3 UkodX7wY5KLTi47UCSvV8gSPdB7CitTekQNxsE2C1riWa5BvW/8tsZPB+r9G9KZ1jCUOUojhywg JTi5SzgnO+Y5NFvPUgSpobHYyGN+evCtQrzGYw89BDuYFo6GdyPPdLICVKzE9/nuGYAraukyUMY 2b/PHRx/nze6RbCjiprdSGvJh8SorpUCOmETbYsfJFzD8cX2mugPcID/TxKyGRPGI85yOqS2w7K 4SWRnweDIIfG28PZuQ== X-Received: by 2002:a05:6512:3f1d:b0:59e:6111:7304 with SMTP id 2adb3069b0e04-5a0ed8a0458mr4028550e87.31.1771939140016; Tue, 24 Feb 2026 05:19:00 -0800 (PST) MIME-Version: 1.0 References: In-Reply-To: From: Dilip Kumar Date: Tue, 24 Feb 2026 18:48:43 +0530 X-Gm-Features: AaiRm52eCNDOaocGMAzHoqjkn9JpJmqoJz74PVohHkuVMVbSx1FoPMhBhl1oLSU Message-ID: Subject: Re: [PATCH] Support automatic sequence replication To: Amit Kapila Cc: Ajin Cherian , "Hayato Kuroda (Fujitsu)" , shveta malik , Ashutosh Sharma , PostgreSQL Hackers Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On Tue, Feb 24, 2026 at 4:55=E2=80=AFPM Amit Kapila wrote: > > On Tue, Feb 24, 2026 at 4:34=E2=80=AFPM Ajin Cherian = wrote: > > > > Currently REFRESH SEQUENCES can only be called if the subscription is > > enabled. All it does is change the states of all the sequences in > > subscription_rel to INIT, this will prompt the sequence worker to wake > > up and unconditionally sync all the sequences. For sequences in the > > INIT state, it doesn't check if there is drift or not, it updates all > > sequences unconditionally. From your discussions with Dilip, I > > understand we want to reduce the time it takes to REFRESH SEQUENCES at > > the time of an upgrade. If so, then this might not be a good approach. > > > > The point I was trying to make is that with automatic sequence sync, > we won't need to execute REFRESH SEQUENCES before upgrade or failover > as the sequences will be in sync. > That is a valid goal, however, the sequence sync worker is an asynchronous process triggered at specific intervals. For a switchover to guarantee consistency, we must disconnect all connections from the current publisher and wait for all pending data to sync. Relying on an automated, interval-based worker at this critical time is risky, as it directly extends our downtime. To minimize the cutover window, we should either treat sequence data the same as relational data (synchronous streaming) or manually trigger for the sequence sync during the switchover phase, i.e. REFRESH SEQUENCES. Anyway this is my understanding, do you have anything else in mind that how you are trying to completely avoid REFRESH SEQUENCES. Having said that I agree that in many cases where sequences are not frequently modified it is very much possible that when we are in switchover phase all sequences are already in sync and if we can identify that then we can avoid REFRESH SEQUENCES, but my point is we can not completely avoid that in all caes. And the cases where we are frequently inserting into relation which has a sequence type field the sequences will be freqnectly modified and we have to call REFRESH SEQUENCES. --=20 Regards, Dilip Kumar Google