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 1w2zQo-000nGb-0c for pgsql-hackers@arkaria.postgresql.org; Wed, 18 Mar 2026 22:32:02 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.96) (envelope-from ) id 1w2zQl-00Ev1T-2E for pgsql-hackers@arkaria.postgresql.org; Wed, 18 Mar 2026 22:31:59 +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 1w2zQl-00Ev1K-0h for pgsql-hackers@lists.postgresql.org; Wed, 18 Mar 2026 22:31:59 +0000 Received: from mail-lf1-x12b.google.com ([2a00:1450:4864:20::12b]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.98.2) (envelope-from ) id 1w2zQi-00000000R96-01Pn for pgsql-hackers@lists.postgresql.org; Wed, 18 Mar 2026 22:31:58 +0000 Received: by mail-lf1-x12b.google.com with SMTP id 2adb3069b0e04-5a0ff30b240so70766e87.0 for ; Wed, 18 Mar 2026 15:31:57 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1773873116; cv=none; d=google.com; s=arc-20240605; b=BQoJ6vVhtWefEd2WC6VUTkxFNoUQ4TtkViJCfMu6w/KleNqH3fL6oStyEjJc5F3VdC an//ItZd3GKIKhvsXrVfPXNON263wTEiyFRqT9uVdpkskewIW6cukAhQKwd0XENn6C8s B+kNXCee6kD+Sjm7iE0+PhhsUoKPBqbPO3JSXcmwiis9j/wC2Jxue3IsF8O35SAvvDYd Gs4pRD0IXLjAqyH5hZeYD6lVsCKmuNKvT8s5J8/cpDeAJAM7hCR1S5rozjtid1MLZlIm 31PLS66s92JEUNo4RApFAMpdOmWYZRrflfGxBNusdAjizb2vf3LimJLnhAKDAQpVvhue tdoA== 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=yXerzlhJptPwREQ6RgF6wGDGWNmLWsKnNHeY1/Df5A0=; fh=5V+QZlM5I8EDdsGSYCtG3kvPTcsnezRKXFpUiwB9kS4=; b=DhVSgeZo4qgs1y2dpECzKI+wWuUfNMcM0RyJ+n0BmTGsLEDes08FCCE79Qksv2QfhA sMPZHQQgk0UGk9ecJBqPyfOAx4902kj6e8/Dw1WAuIynvPgQEwV9tC6gkS3tS1q9NSlD Q/6bI02sAYF8hcA74caQ7Hzgb0v9fJ62vZvwEYPErYeBUMFL7yRvXxWy8gedFAwAKavt qVHeKQsFdyuztWGQCXgcLKqtSVlWzXHiXeFlr3DZnhiTozJtVLWIUbFbjTq2p6fIQFmH AC7nF6LLB1CfukeFZC+V/Joa53tQvhKEYfHd0qOQDBOi6w0GUzYjUcesLOaTsq8QBDu3 pzAw==; 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=1773873116; x=1774477916; 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=yXerzlhJptPwREQ6RgF6wGDGWNmLWsKnNHeY1/Df5A0=; b=GbVhJdV3iFo+iHTcyC0tIrnRaU5PttNmQVM7utfrXPELpvUgkKs7T/uYqu4OerwrRj KkfDEMmCv2nFjRtTYLdzDy/AywxYaALHMFBepYBSXJoMC81FSp8zvqo9VcuF7XlTby+o V8R/lgcd1r3Xbq3djiP36mTl1ogmE48uH9xEafdWI1bKuDAG5az0JJhS6Tjfg823kTij w/m6vbeJCbyQ1YXyBC9ikrHwXeznsWSx+8Il4ziuCFJleXol/wRWgUvdA46U3g7qdGJw hCBy4fTWjt9HUQLh56zQjQggpjsJOiwzl4jFrdcUfyGOwbbtGwJ8KstuiMZkJjY1530P HRbg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1773873116; x=1774477916; 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=yXerzlhJptPwREQ6RgF6wGDGWNmLWsKnNHeY1/Df5A0=; b=CjdGkkJ/bBc/AgInmvBy/0kXoMs7e30xCQ+qE/YRRADGInoR7wVbBcCklFFc+wbUNK GLz9yZvz0ToyipgjMvI9h3lkbQEF0xzi30FPWpvZKVN2jzT325sj+G2tupJeWvhIDAb4 Y8hQvrw6SdPFxdUiV5iSgndDYa9dbZUynNoUSBkxzl5Ae4oACUody/0ConU60uEcYj+Z /URN+t59EfR0LKHCj8iSDrQELTF0bfNEdhyLgmsfKFX8N2FWIkZ+SaE33ea9jwpG0KEL /EFhbECjIijLTYlHoXeN7NYFupggSmENLvkdqJlwyFwceIVOIIJLYFyN94DZ6jOdJUnO 4/vw== X-Gm-Message-State: AOJu0YynZrj6GIM7P4klGfNuQVz5wq2osnkWLso+vd6HIAuTn5oYWSqH mt2UAVs9MbW7Jy4Ag3XTjPiAD9tZlEVn4YElldxuysIKZu0dRkhlvXc+mge+ZdsePHnbvbEjdaj j8uT+7T092D/qqw7njnI9YDal2aIa28hmn2t5 X-Gm-Gg: ATEYQzyIr3VTizavMi1zxLW69tR9yw9cJmQMlZtZ1GxFJaFUbEa8jOBwLkH15e38JvN 7fLAbnjS3VBJfBVKHDZ6WKfix3LRpiDqS9YCGMi9qDfcqVI3I9TBxNv9BUAjmMKvIr0z2orogQt gBlgFjvTf2veWdDSSet7q5JAlbNK2SOTdb/2Bpq765Iii9crr7ssf8Lkp30KsEsjf0S7g512f+O S0CCA3RD5dj/HvIlmjj8QIv2Df2AkDF2gAwK0mfka/Ozy6X/QekTf6v25z5mqsywvUCWQlCivyB r/j8ygTM X-Received: by 2002:ac2:51c5:0:b0:5a1:2fa5:b98f with SMTP id 2adb3069b0e04-5a2796b438fmr1910429e87.26.1773873115349; Wed, 18 Mar 2026 15:31:55 -0700 (PDT) MIME-Version: 1.0 References: <0c28fbd1-3320-4e9b-815c-6d62753aa063@wi3ck.info> In-Reply-To: <0c28fbd1-3320-4e9b-815c-6d62753aa063@wi3ck.info> From: Masahiko Sawada Date: Wed, 18 Mar 2026 15:31:19 -0700 X-Gm-Features: AaiRm53U_ZDjv34mAd3Qkny51r3Ha0nOyWshvpgHaZpEv6-53XiwyOwOiqvIzYQ Message-ID: Subject: Re: Initial COPY of Logical Replication is too slow To: Jan Wieck Cc: pgsql-hackers@lists.postgresql.org 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 Wed, Mar 18, 2026 at 1:11=E2=80=AFPM Jan Wieck wrote: > > On 3/18/26 12:44, Masahiko Sawada wrote: > > On Wed, Mar 18, 2026 at 6:56=E2=80=AFAM Amit Kapila wrote: > >> > >> On Tue, Mar 10, 2026 at 3:40=E2=80=AFAM Masahiko Sawada wrote: > >> > > >> > On Tue, Mar 3, 2026 at 2:22=E2=80=AFAM Zhijie Hou (Fujitsu) > >> > wrote: > >> > > > >> > > On Saturday, February 28, 2026 7:48 AM Masahiko Sawada wrote: > >> > > > To: Marcos Pegoraro > >> > > > Cc: PostgreSQL Hackers > >> > > > Subject: Re: Initial COPY of Logical Replication is too slow > >> > > > > >> > > > Another variant of this approach is to extend > >> > > > pg_get_publication_table() so that it can accept a relid to get = the publication > >> > > > information of the specific table. I've attached the patch for t= his idea. I'm > >> > > > going to add regression test cases. > >> > > > > >> > > > pg_get_publication_table() is a VARIACID array function so the p= atch changes > >> > > > its signature to {text[] [, oid]}, breaking the tool compatibili= ty. Given this > >> > > > function is mostly an internal-use function (we don't have the d= ocumentation > >> > > > for it), it would probably be okay with it. I find it's clearer = than the other > >> > > > approach of introducing pg_get_publication_table_info(). Feedbac= k is very > >> > > > welcome. > >> > > > >> > > Thanks for updating the patch. > >> > > > >> > > I have few comments for the function change: > >> > > > >> > > 1. > >> > > > >> > > If we change the function signature, will it affect use cases wher= e the > >> > > publisher version is newer and the subscriber version is older ? E= .g., when > >> > > publisher is passing text style publication name to pg_get_publica= tion_tables(). > >> > > >> > Good point. > >> > > >> > I noticed that changing the function signature of > >> > pg_get_publication_tables() breaks logical replication setups where > >> > the subscriber is 18 or older. > >> > > >> > >> Why adding a new function with additional parameters (Oid relid) > >> couldn't help with such a case? I am asking because your previous > >> version code looks simpler as compared to the new patch version. > > > > I tried to pass a relid to pg_get_publication_tables() but we cannot > > avoid changing its signature because it's a VARIADIC array function. > > The previous patch changed pg_get_publication_tables(VARIADIC text[]) > > to pg_get_publication_tables(text[] {, relid}). However, changing the > > function signature would break the logical replication from v19 to an > > older version. > > Would it be possible to use function overloading to provide both > signatures handled by different C functions internally? Yes, we can define both pg_get_publication_tables(VARIADIC text[]) and pg_get_publication_tables(text, oid), which seems like a less invasive approach. I'll give this idea a shot and see how it goes. Regards, --=20 Masahiko Sawada Amazon Web Services: https://aws.amazon.com