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 1vvc7P-00AINo-0R for pgsql-hackers@arkaria.postgresql.org; Thu, 26 Feb 2026 14:13: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 1vvc7O-00D1PX-0G for pgsql-hackers@arkaria.postgresql.org; Thu, 26 Feb 2026 14:13:30 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1vvc7N-00D1PI-2A for pgsql-hackers@lists.postgresql.org; Thu, 26 Feb 2026 14:13:29 +0000 Received: from mail-lf1-x133.google.com ([2a00:1450:4864:20::133]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.98.2) (envelope-from ) id 1vvc7K-00000001JD0-3U04 for pgsql-hackers@lists.postgresql.org; Thu, 26 Feb 2026 14:13:28 +0000 Received: by mail-lf1-x133.google.com with SMTP id 2adb3069b0e04-59e5aa4ca41so701014e87.2 for ; Thu, 26 Feb 2026 06:13:27 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1772115205; cv=none; d=google.com; s=arc-20240605; b=A0qCBQBE2fuxlxv2T7o8ex+0waj2L4J564xAvxkxboh+Sc6kYbWfcROpvweQkvGUIX SprjfULHAiOjJ2WAMn7gCAajZbx+5X5W6IlqpeT2j2hqk5WgQalsgmhhVpO5V6TEU/Na iyBBUM/wVbsuQ+DCPoxNjxYtYgDYxbWgjairZqaiPvFjYU+0BSEV7SBC2ShpPSad2NEU hNMCykUJgljlHENjLl8iP21uj7fiJhr/feRuvoVbuh4y/0KiuoTqT8zphl2aHpeUp4IR fvKRgrmPEyNBpsypp0CmGPklwNMVkycZUimvo3BOt1eFxlPG6+LONu8sXcX/7nOPzNVB ClIQ== 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=5SOnXBsUxT4JEMdqQbhKTTrLTBp5JguV1UqFaUm9+SU=; fh=/5snoQaIWtMd3BNUK+x05gL1FZgT20bDS1gb+8l2ZNk=; b=MW6Z73NaCbKT0mqAE2qWLq+nmCVfW67tOeMZIR7Yt9lN06fbiDN8oVg2J7yOAb7tsI 6kNkl8QkfcJfxcQAvu1cdqsenEenoSNAnh3x35IPE2KwM6gUr4y6iZmbL9rk4apTjTla SgF0qQ4RMxCOpy4pRt5+dHhpxBFmUE0i0BQULJ8jytEMH1RrJKSKz5h6fPpFhj1mmWAV aG4MSEPc2M9DBYToEzqPEq/TepjS8reMSB/pKQWXzLPmhh8w1ek5W25S/jf8i+Z7ld2E 6RgE9ApqJybwGlaRFmKHar3YuYeR+01M0skarjS0caR0IP7OheiMUdMr8hVH1PYga3Gq 9d+g==; 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=1772115205; x=1772720005; 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=5SOnXBsUxT4JEMdqQbhKTTrLTBp5JguV1UqFaUm9+SU=; b=TizcObGld2KLlM0iadllzqL3tvlTikDHlGSCGpXv02M3jYfIjtHz9x68PRl3q1o34v mgnRfPFzda/467zpNMS3aPch6Uhk8ojPz0Qc4u42dZB2J0N6IW1Wtenp+tzfx2TU6VHP sPsCXKDTgMD6SWk0+Yq4kALKI4rFd6Obj3jNwGNg37xqB1u5bDhCda5bZx51RzRQx2tI 4RR1C5t0xKQo/oN/xGUwp2NKdFmriVRPpvFKiCY9EP3Onvld1V9ahzQ23FXceqtUGiL4 crgWyBLzIvcbnZvrDuOJbTRvYXFNVg02EaMJtP0u+fMc7m7XTOg4MjupZ6kf/UyDFOJN J/RQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1772115205; x=1772720005; 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=5SOnXBsUxT4JEMdqQbhKTTrLTBp5JguV1UqFaUm9+SU=; b=ZPy0gA1LzoCahwzNk1q19LXAmC8jrUoKh4rpRJDflHBBzEN05zBQQOY/3hnwpMYQXt AExEq68zYX0aSoAhhVwnjmjTOofN1UWCyQQD6EiTtsBb6wMrcuYjKhZND3wpvhXJ3CR7 S2De4xD9CQYKKCYJZ4Cq31COdMY/02QXwWfmh6j3oZbfzQnJbDdAqpSJqO3kboA9HEi+ Wwg0m9a08RecHjiCcp5tfkfh5US6YuwgJqyja6io9hVk0DwJ7e+4MFomdcZKyS1ZgsGg xec1J0K3xOoraE/TvHmbwBcbiMm3/lHfAUlPf2wcBntTa8Gk2tZqR05liOPI597nOkC7 jZQQ== X-Forwarded-Encrypted: i=1; AJvYcCWdllipD8aOVH1KqDu+1HWJCJN3+Gq+kImRyeLc3rLSftpQoFzsoidtS9D91DxJMcgmr/kt4NLpfTgUZxvf@lists.postgresql.org X-Gm-Message-State: AOJu0YxCOhew44IY+PIZKjcFXlGgC7g3lXpTLzMPmiESTVk+CbS0YszM +JsfZYaOV4D6ZaTn5wcx4iVvMKxIPDvgP2OATatJPLiHI09GPgLr19YcAJ+OAv/46gkSpUCnnL0 DHm5p309BXw/rfPuxmop9+71P7r1gcA== X-Gm-Gg: ATEYQzznJ+D4Bdfrcb8USzPDq1dlPYk52yZCkwaQPY2dzvnkC5V8BUGvBowl8aMpQm3 ClLhj+sVWt3j1nJ9TqZPNctfif82ZI2qM3zcoAx9/03UnhEoSU+Gu0jBvbimC/vfb8jcM6Ctwux zluwYRdr+gJPRnwT5mkxKBwDCzmbDYp7t8olPne1+THiy8Rt5cOSAMJAfWOfCLymcfMYP4Dn/uj E9rMtcu1vsS0O38deiKFk6HsX8+gXKBe4kNtnJ0CrHwIcpUlGITmbAcbW7tbOq+B4x9qadmT3rm 7OZnNv1tyDp7isdgY3ix9nVmbJh8OuWMO5gyNcAK X-Received: by 2002:a05:6512:124d:b0:5a0:fe70:407c with SMTP id 2adb3069b0e04-5a0fe704240mr2639769e87.33.1772115204985; Thu, 26 Feb 2026 06:13:24 -0800 (PST) MIME-Version: 1.0 References: In-Reply-To: From: Nisha Moond Date: Thu, 26 Feb 2026 19:43:12 +0530 X-Gm-Features: AaiRm51dOxOH6HH9lgWwxJV35CK6cgWzvQSkSLHE1N48RHuNYndvjMudDDefH64 Message-ID: Subject: Re: [PATCH] Support automatic sequence replication To: Ajin Cherian Cc: Amit Kapila , "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 Thu, Feb 26, 2026 at 1:07=E2=80=AFPM Ajin Cherian wr= ote: > > On Tue, Feb 24, 2026 at 5:17=E2=80=AFPM Amit Kapila wrote: > > > > Can we find some cheap > > way to detect if sequencesync worker is present or not? Can you think > > some other way to not incur the cost of traversing the worker array > > and also detect sequence worker exit without much delay? > > > > Added this. > > > Also, shouldn't we need to invoke AcceptInvalidationMessages() as we > > are doing in apply worker when not in a remote transaction? I think it > > will be required to get local_sequence definition changes , if any. > > Changed. > > Thanks Hou-san for helping me with these changes. > I also did some performance testing on HEAD to see how long REFRESH > SEQUENCES takes for a large number of sequences. > I ran these on a 2=C3=97 Intel Xeon E5-2699 v4 (22 cores each, 44 cores > total / 88 threads) 512 GB RAM. I didn't see much value in > differentiating between cases where half the sequences were different > or all the sequences were different as REFRESH SEQUENCES updates all > sequences after changing the state of all of them to INIT, it doesn't > matter if they drifted or not. > > On HEAD: > time to sync 10000 sequences: 1.080s (1080ms) > time to sync 100000 sequences: 12.069s (12069ms) > time to sync 1000000 sequences: 139.414s (139414ms) > > testing script attached (pass in the number of sequences as a run time > parameter). Hi Ajin, Thanks for sharing the performance results. I ran the same tests using your scripts on a different machine with the configuration: - Chip: Apple M4 Pro, 14 CPU cores - RAM: 24 GB - Postgres installation on pg_Head - commit 77c7a17a6e5 For these tests, I used shared_buffers =3D 4GB. The time taken for 1M sequences is increased significantly: time to sync 10000 sequences: .994s (994ms) time to sync 100000 sequences: 11.032s (11032ms) time to sync 1000000 sequences: 426.850s (426850ms) I also tested with shared_buffers =3D 8GB, and the time for 1M sequences was 441.794s (441794 ms) -- Thanks, Nisha