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.94.2) (envelope-from ) id 1t1KH0-00FjW5-5g for pgsql-general@arkaria.postgresql.org; Thu, 17 Oct 2024 06:46:14 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.94.2) (envelope-from ) id 1t1KGx-0003F6-Ow for pgsql-general@arkaria.postgresql.org; Thu, 17 Oct 2024 06:46:12 +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.94.2) (envelope-from ) id 1t1KGx-0003Ex-D7 for pgsql-general@lists.postgresql.org; Thu, 17 Oct 2024 06:46:11 +0000 Received: from mail-ed1-x529.google.com ([2a00:1450:4864:20::529]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.94.2) (envelope-from ) id 1t1KGu-001UHY-3t for pgsql-general@postgresql.org; Thu, 17 Oct 2024 06:46:10 +0000 Received: by mail-ed1-x529.google.com with SMTP id 4fb4d7f45d1cf-5c962c3e97dso746757a12.0 for ; Wed, 16 Oct 2024 23:46:07 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kleczek.org; s=google; t=1729147567; x=1729752367; darn=postgresql.org; h=to:date:message-id:subject:mime-version:content-transfer-encoding :from:from:to:cc:subject:date:message-id:reply-to; bh=IEGnQZ+YjxZPuqHQBQMnaYu+iBXbKDgAuLVrVvyY4ts=; b=FqeYhJo180kaBs89U/ECc3y0CdvVoGvL8tuDpeOPAYjpfZHREhpkQOg9K9LpdMFsFx kXbimur0rl/Jaf7GMLuQ2XAbxVyYWYbwxtpN257QxrAKyAbhmQsVrJt14vwlTgdVV1ve FaHTGZ6j8c1yVQ9ttbG5/ugFNjEx1cVUADODw= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1729147567; x=1729752367; h=to:date:message-id:subject:mime-version:content-transfer-encoding :from:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=IEGnQZ+YjxZPuqHQBQMnaYu+iBXbKDgAuLVrVvyY4ts=; b=xKKAdo9HmUthWLNxDheibiu50OclewOvUUvFM+AtRYpO8m1K3jpNpjLiYSUQ6KDlM3 dRkkR6In+j9PretFM8FOz3NzK8tgVT/06rY+M+HDmqaliepAiXpFNkO/fdLCTJXWwfI8 cwNZPtU9hQ3lcZHey0oA1HWF/zhdQBxsh70fT3GxbLPaAAQa4NjvccqzJAxUOi5XDrwY PUu1MJAlha4gXQrhNHfrm8QmbDOaw1xfDcKArMF0nqe/sC5pBxcy/Kzt1Rd7ypfgZCe6 uIffaYY6rvHyC+vSmofhK1iJ8bXhVfA8xTL2D5gvRHwH02MotidPYTgTY2x1PtqFfXwk JtyA== X-Gm-Message-State: AOJu0Yws9qVfFqH+8BX9f3ilGA8rN6HTASX+U35cHlNJVnnOz82205YM RYBdXNEFGKNFOL46j3BBFYaM7qwJmYoAU4v6WyBBuEY7otiOVgQoPVGkUGzNzFkKAOlalT8myHl qJorL9w== X-Google-Smtp-Source: AGHT+IFR/KpaFUuguaKvEaT7yQ0Mr8HXPKUILUSYNMi7YTd1cFEcPpMuwNjhB6rUxuaH1BGnizCgfg== X-Received: by 2002:a05:6402:5210:b0:5c9:4a35:7a20 with SMTP id 4fb4d7f45d1cf-5c94a357bc6mr16159556a12.14.1729147566497; Wed, 16 Oct 2024 23:46:06 -0700 (PDT) Received: from smtpclient.apple (b15.kleczek.org. [185.20.172.182]) by smtp.gmail.com with ESMTPSA id 4fb4d7f45d1cf-5c98d77b52asm2346940a12.76.2024.10.16.23.46.04 for (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Wed, 16 Oct 2024 23:46:05 -0700 (PDT) From: =?utf-8?Q?Micha=C5=82_K=C5=82eczek?= Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Mime-Version: 1.0 (Mac OS X Mail 16.0 \(3776.700.51\)) Subject: Merging logical subscriptions Message-Id: Date: Thu, 17 Oct 2024 08:45:53 +0200 To: PG-General Mailing List X-Mailer: Apple Mail (2.3776.700.51) List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk Hi, I have a question about an algorithm to =E2=80=9Cmerge=E2=80=9D two = logical replication subscriptions. Here is the scenario: We have a server with many tables replicated using logical replication = to downstream replicas. Each table is published with a separate publication. At the moment each replica uses a single subscription with many = publications. The problem is that a subscription is a unit of concurrency in logical = replication and sometimes we need to process replication streams in = parallel. =E2=80=9CSplitting=E2=80=9D subscriptions so that groups of publications = are processed in parallel is (quite) easy: 1. Disable existing subscription 2. Clone replication slot 3. Create a new subscription with a subset of first subscription = publications (don=E2=80=99t create a replication slot, use the = replication slot created in step 2, don=E2=80=99t copy data) 4. Drop the subset of publications from the first subscription. 5. Enable and refresh the first subscription But is there a procedure to =E2=80=9Cmerge=E2=80=9D subscriptions? The problem I see is that there is no way to synchronise two = subscriptions so that they stop at the same LSN. We can skip transactions by advancing the LSN. But we cannot process = transactions until a specific LSN. Any ideas? Thanks, Michal=