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 1w56iJ-002tvP-1l for pgsql-hackers@arkaria.postgresql.org; Tue, 24 Mar 2026 18:42:51 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.96) (envelope-from ) id 1w56iI-008Sq7-0L for pgsql-hackers@arkaria.postgresql.org; Tue, 24 Mar 2026 18:42:50 +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 1w56iH-008Spz-2f for pgsql-hackers@lists.postgresql.org; Tue, 24 Mar 2026 18:42:50 +0000 Received: from mail-lj1-x236.google.com ([2a00:1450:4864:20::236]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.98.2) (envelope-from ) id 1w56iG-00000000pqP-2P92 for pgsql-hackers@lists.postgresql.org; Tue, 24 Mar 2026 18:42:49 +0000 Received: by mail-lj1-x236.google.com with SMTP id 38308e7fff4ca-38bdb4b8e66so34237361fa.2 for ; Tue, 24 Mar 2026 11:42:48 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1774377767; cv=none; d=google.com; s=arc-20240605; b=bgiBkIYVZr7mj+0vWztYiJ9trlDTvrhIWY7Y7BfLwqLIwfeCMof0FsdimU7xjARfTM LDjllOijL4mJxOOGJMWWlZQH90RNDs2SIhGE+LtWNtDfGfYFBD7EIl0Hk4WPeNHLlrZP hViHalOcTT7pPCigpZ3NQU51sH4vJC8BRPkbnudad10ZSxcF6ONtbM71ohX87CmYgTxD s6AX8onjs5R4RfmjptmimGHD5Myf7P7Kx5pAWlV7fL86p+kPpkgdd3cmW9sIADWRBwc8 GK3kp1bFMjYeKHAFEHn7pBle7kx82ENpYS0KBHvKkqNa+4eBHlRJxRLRzSZnoRUTa+ut 9uUg== 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=EbpHBn4aY0fe+2iK86VQ857IZi7aQEhTkjbU564sNm4=; fh=0YZfcOKBrMII94v5gOULcf3IW80fJeHQobnKOFIPySw=; b=iAZCKbfT9uFfFx+Yz9epivnNT+ghI5El5Z3a00X6xSAegS2doZja79N0W0Z6T8eAA/ exhfqkzTwBQ3R4xC47vpvCpfzgLQGA+d14eOeBhDYquKAajpI74H9V3h8ArLWzeWu3Y+ w8AFsv6juEpMDouf7HWtkYU/U3J0vTZXlT7vfWE9eP6+ujhqz5rl9m/8XIzXErs202DY NoeVKdNjLTg3Klj9QKqdXKIv7ymYNMio/vkKGDKFLKMwV9Lq+NArv4DuXxiWPHJ1587f XcJhm7QgjEx4fYR48zrNERHMQiHdJ53veXW47r2nNLEvzFwsexuCs67Q2GVTYkCRBdmg KVvw==; 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=20251104; t=1774377767; x=1774982567; 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=EbpHBn4aY0fe+2iK86VQ857IZi7aQEhTkjbU564sNm4=; b=GBg3bCzwSZ5O7QJE6K0abrqbrpZgi5WpXxmLGYjq8pSofwGlPyLZNkzOYFdk7Qydil 9vAifHinvhg+NX4Uy+dP8ULWcZ9KInd8I/ik/FYaMdu4jAL3B3//G0ionWwBF5MtwXqp 3BZQ6u7iIZnbpZ2WdkWTArmZDJFi4VvaDnL1HBHlMEVgGlAqs5b2jfQ/1LpFhtiIOmnG DkA25KfgWoLlmiK5zv4TiQAJVER8h6t0dwfD3hMndJA819lWJsOkS8GPwkaRrjhVHLC4 2VXaWna7GK6c5JvtE5XXmlcGEZNOWNaXx+ujEDE/uteirsy74KI0CAToQzhJYGskJIWH lfUg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1774377767; x=1774982567; 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=EbpHBn4aY0fe+2iK86VQ857IZi7aQEhTkjbU564sNm4=; b=Cu7WXLbIxAZRZmWYsSX+2vC6E92iQ3KP8+iaMls+v2l/KlITzxMJgWS+cRweF9Njwi 2TcBZfmCluVNhMscvlRDFzJhTfrRHdHdfZssrbNPHQkpOjlf9O1kK+PDBq/CuPZ6qOqI 5dnyyY2Fwlr1NIfK+2cch87fhWc27qhXf93cWwUfBW/92VyL4ZP33yN75Tu9rkgU13aX Q8y5pZZE1Mm27c6QgU0Tf3xKctyun8FtGnj1nTQYK6bYBzs5g0XW4gtI7tnYK4SCgP22 MhLaAEyphR6uqJestRewq/a4UmNg/IJ8po0ag0irA20sjkdzWSQgHDEtx6GnHh/cpfge 4DzQ== X-Forwarded-Encrypted: i=1; AJvYcCU+mN6qew9nko4M28ykhehgSMjcZMVvp0Q0nB32n9cInjV5Po1E0zaTzjmO+l6vnuD8gtZx6gYTiuTWDJsv@lists.postgresql.org X-Gm-Message-State: AOJu0YzZVuXbKtO6s09oU4XSNq97DR9o0U7/t9dqYQyc0uUhLMeTQjYh 36sfyMB/iPBSg75csFQs3t2UJ4nGniisz09127Y+Hq1LwWmCDucgv+aySzfomh21fVV08WLFscN SE2f3kPp7rqFre3TkWEwD2F+98MzPetI= X-Gm-Gg: ATEYQzwOtvihLaEWMZQfQxvh4SzpPPp1q9M+cvPUxv24W7rI9x/Ee8HKa1NASedDPhi Vh0ExIPV3uKbHgjZ1kKqdsFlfZ6KE+lmg0+twLyaCA7bdYjkjp6khOlNeT+WG1uTOARhMDIoAYP 9fV5vNwDfld3i5wzMlYXUy+E2YHe4EYHSurRYlgvsXWN4pb5J/nz4gMrUUjuydMXx72Gkurn6FR XhW5ukV3Q7vFtdGADcdM3gLzWqFQp32DifoCsEJbq4m2pQOikrIkz//rvaAoVFUc2llS8RcBVVp Xj6rXr5+Fs5qLJg6E7czplPIkiDqlez6BqmOkg== X-Received: by 2002:a05:6512:3f14:b0:5a1:19c4:7a68 with SMTP id 2adb3069b0e04-5a29b99274amr204170e87.36.1774377766683; Tue, 24 Mar 2026 11:42:46 -0700 (PDT) MIME-Version: 1.0 References: <0c28fbd1-3320-4e9b-815c-6d62753aa063@wi3ck.info> In-Reply-To: From: Masahiko Sawada Date: Tue, 24 Mar 2026 11:42:10 -0700 X-Gm-Features: AQROBzDyvDeAXOafPXzU9oDdod8WmQ-5_69gRmPhBLfDMOuCsA8Fv31tTBDGjyM Message-ID: Subject: Re: Initial COPY of Logical Replication is too slow To: Ajin Cherian Cc: Jan Wieck , 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 Mon, Mar 23, 2026 at 11:54=E2=80=AFPM Ajin Cherian w= rote: > > On Thu, Mar 19, 2026 at 10:30=E2=80=AFAM Masahiko Sawada wrote: > > > > I've attached the patch to implement this idea. The patch still > > introduces a new function but it overloads > > pg_get_publication_tables(). We might be able to handle different > > input (array or text) in pg_get_publication_tables() better, but it's > > enough for discussion at least. > > > > The patch looks like a good performance improvement. Some minor comments: > > 1. src/test/regress/expected/publication.out > > +-- Clean up > +DROP FUNCTION test_gpt(text[], relname); > +ERROR: type "relname" does not exist > > Cleanup actually fails. Second parameter should be text, not relname. > > 2. src/include/catalog/pg_proc.dat > > + proallargtypes =3D> '{text,oid,oid,oid,int2vector,pg_node_tree}', > + proargmodes =3D> '{i,i,o,o,o,o}', > + proargnames =3D> '{pubname,relid,pubid,relid,attrs,qual}', > > Having two arguments with the same name "relid" seems odd, although > one is input and other is output parameter, how about calling input > parameter as target_relid? > > 3. src/backend/replication/logical/tablesync.c > > + > + if (server_version >=3D 190000) > + { > + /* > + * We can pass relid to pg_get_publication_table_info() sinc= e > + * version 19. > + */ > + appendStringInfo(&cmd, > + "SELECT DISTINCT" > > In multiple places in the code pg_get_publication_table_info() is > used, instead of pg_get_publication_tables() Thank you for reviewing the patch! I agree with all the above points. I'll share the updated patch soon. Regards, --=20 Masahiko Sawada Amazon Web Services: https://aws.amazon.com