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 1vuqXq-009RRB-2X for pgsql-hackers@arkaria.postgresql.org; Tue, 24 Feb 2026 11:25:38 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.96) (envelope-from ) id 1vuqXo-000o5e-0y for pgsql-hackers@arkaria.postgresql.org; Tue, 24 Feb 2026 11:25:36 +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 1vuqXn-000o5O-36 for pgsql-hackers@lists.postgresql.org; Tue, 24 Feb 2026 11:25:36 +0000 Received: from mail-lj1-x231.google.com ([2a00:1450:4864:20::231]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.98.2) (envelope-from ) id 1vuqXk-000000012ZV-3lTv for pgsql-hackers@lists.postgresql.org; Tue, 24 Feb 2026 11:25:35 +0000 Received: by mail-lj1-x231.google.com with SMTP id 38308e7fff4ca-38706b63929so47828181fa.3 for ; Tue, 24 Feb 2026 03:25:33 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1771932333; cv=none; d=google.com; s=arc-20240605; b=VOb7PkRS+UjchLaY+539BMIl5yZjF2NCy9JkYROemjZZSZEwYK/WFSxcrV5eg9RyCR kl2ntAMJl7Sq2EDvX66fkx+SWpv53aDsxUGkuW34MPUw17buVwL1tEMOcpuIiNjRXPUX T+YYP2iI0NWGiEXQBNcgF9rH1RGbLyHqOkf4OLubRdR4bxgOaP/mv07/kQoo4LZtYh0M V5SFv48OOQRNxp4nSHvyFBAkHUnJp6SdWQYuvIao7UwCEm2GzwCx8g247b3SQv0RXuzs nEC2UETMBEkdw6hxuttsakLz2Tb/mavn1PwH4HNnt25m+mtwyLLGFwghXos1+e8qGzIr P2CQ== 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=zQrGA3ZJba4tvMDcOOT0fLHjbg4a1k4kknh6BPfZa88=; fh=li3M6gTC7GzJLpNCNoxzU3hNYF3vPo/o+C6kwS0R6dg=; b=N55lUwCpg7CojNIlurSQDIxTuN9U0WAAHQlsM4IxZc4QLKT3Xq12C9nA2QwY674nxe 874cP7V1rt/TJwg2bFWQjbT22q8MISY39cCNMfA+EQOz8yc2nAxVe2eAIMtX53cw2bWo UVXbwI3X6KJ60g7yPQmJRRapLnwI0IZdKNrRnjzebsB84mAwP96FhdavWBOGl6LfJhNw 6qAVkmYc4QmE6Zjl8kHgIScjRt7fHtIIuviWKkRNjKSLS0laksxVQ9lVq/T57yV/oKLm 6Qi29doOSwkkOiIgnPfu8qA4cPstuIAXMz3tJuIrflvIOOlkYK1iKM1SZsRYE9sGDLJQ DsYg==; 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=1771932333; x=1772537133; 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=zQrGA3ZJba4tvMDcOOT0fLHjbg4a1k4kknh6BPfZa88=; b=fdogcDd+6mYFgqQrxVIoUcIv9nd784EninjYhwD1c31I9dprKXw6qccM9MubCEOl5j rw8xqyix/7IWReRc1dfYCNhBSxEukz/40YrbKV5c3tO3yatvX8kKFJVbw28R5jZsZYjN Qi/DJIY67lIMGvBf1y3SF5RVqeRYMs/mshXiuZb5IjQbFsWnB35GdewF/uxBLYjW1b5n VDhpdiGNgJ8Ml2hSyYuhnd/0wIMoXj3Zq2PrDWP+zaCHN4U6VptaBaU7exTUuTnV2tsc E5JitGvKGicdeocz3JeUSLb//AY7WKG9u0Pvr5pE3usDSD8ovnMH/HCZoiTyLR3BV92X B0dg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1771932333; x=1772537133; 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=zQrGA3ZJba4tvMDcOOT0fLHjbg4a1k4kknh6BPfZa88=; b=NXULZ5oq6QG6NnYqQZNITdR3aEVz29f8F8hyuw9uO3soFM0Gf+3W+w9Zivruy/fdW6 r/oI6fiEm8gI1dyBbMRdR9EzcVidAzGCH8dYWrnDzQuL9eFmN1tc9Cepr1T+Xq0nUZ9e mxZR0eCFvG0jtzg+repdStHBOZEY8RK6QaQAljwVh2FWboCPmmZlAwwjSgT92gAOHuxp kAonjCpz0MGF+6KPS1BODrkRaK49/ZseLh+uNCLmYabrJB8F8VCz20A5UQD8woWQB99d pd/2B564I9l1XZIr60o76SGsIZz1oDGmqC3qom3+u7aZ3IUEhL30Oce8Dk1hsz9RSPis +kPw== X-Forwarded-Encrypted: i=1; AJvYcCW8VJEsMCykLO94Uvpb0aDLt/AH5nRigGnYFVcbBLDNyoZDXYXwSNwf4qF1s02EfUYaIdAZJpi073k4bXz0@lists.postgresql.org X-Gm-Message-State: AOJu0YxlpCH+ZBAj6Y6Q+5WcW0QAeccEbOkgGYrN6B66XiDal+f5QnAB 3l03f3nHSBxMLsxKG+yDnlOBvDn6ep9HJ40P54nTKvAoMDdoIzi7FBE7OxNMEkxe1B8Z8xTlVeK 1m7Vo6zynHlZqbrXU9SfbBjyLuzbq0e0= X-Gm-Gg: ATEYQzytzPj7VMxz+VPgBGXOag4+h+sUTtNE3GcEheNKNRxHxQlpSJ4/vzzJfUXzJq+ GXzgMUZFraeMVW3mC1nTA6DAUeQANptkcG8l0rGLjTbJ1sTsh7gZJkzNmb84Njw+MSBeV29YVIv U42RS4nIlWm/J8Z/iiP5qyPEOgDKkxsJ+iVVwYJ9nN0kxrK4Gc0u/CsvzqFRPbQJA/LLJY9QsUr WPADJNUdHQd77+TbePatVILNQGZ0iXVyu7f/eH0Ai40rZull3ad421ZDYB9L496WM6bhjdYTIvm gTuiy+JFgqmCQAstdhJPFfh7DOnSs13/S1cSHn+NRw== X-Received: by 2002:a2e:9a04:0:b0:387:cdb:9ba3 with SMTP id 38308e7fff4ca-389a5dea0ecmr38511041fa.22.1771932332355; Tue, 24 Feb 2026 03:25:32 -0800 (PST) MIME-Version: 1.0 References: In-Reply-To: From: Amit Kapila Date: Tue, 24 Feb 2026 16:55:20 +0530 X-Gm-Features: AaiRm536zGCyW25UtfzcuTz2K6l3fAFnGnixuT0C7p0av5I3WIlPLVsjh_-Uj9I Message-ID: Subject: Re: [PATCH] Support automatic sequence replication To: Ajin Cherian Cc: "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:34=E2=80=AFPM Ajin Cherian wr= ote: > > 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. > As not only does the sequence worker have to update all sequences even > if they have not drifted, it also has to update the relstate of all > these sequences to READY. I propose, we change the logic such that > REFRESH SEQUENCES only wakes up the sequence worker, that will reduce > the time as most sequences will already be in READY state (unless > newly added) and only sequences that have not drifted need to be > updated and no catalog update is required for sequence states already > in READY state. One downside to this is that, earlier users could > issue a REFRESH SEQUENCES and wait to see if all the sequences have > returned to the READY state to confirm that the sync has completed, > with this approach that advantage is not there. Users might have to > use a query to find the sequence values of all the sequences and > compare that with the values in the publisher. > Yeah, this point needs more thoughts as the existing method for REFRESH SEQUENCES also allows users to easily verify if the sequences are in sync. --=20 With Regards, Amit Kapila.