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 1w4vel-002hiA-0t for pgsql-hackers@arkaria.postgresql.org; Tue, 24 Mar 2026 06:54:27 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.96) (envelope-from ) id 1w4vej-004oPk-2A for pgsql-hackers@arkaria.postgresql.org; Tue, 24 Mar 2026 06:54:26 +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 1w4vej-004oPY-1H for pgsql-hackers@lists.postgresql.org; Tue, 24 Mar 2026 06:54:25 +0000 Received: from mail-lj1-x235.google.com ([2a00:1450:4864:20::235]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.98.2) (envelope-from ) id 1w4veh-00000000kZb-2RkB for pgsql-hackers@lists.postgresql.org; Tue, 24 Mar 2026 06:54:24 +0000 Received: by mail-lj1-x235.google.com with SMTP id 38308e7fff4ca-38bd3bc3061so8295471fa.0 for ; Mon, 23 Mar 2026 23:54:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1774335262; cv=none; d=google.com; s=arc-20240605; b=HXKk00biw75f/pSqAgsdJHXC7Yc1DM03v+pdj164kBb+kRbZtue59idCSrKp1f2SXk 2Q68VOTjEnHF8fhZ4jOSBKfPRzuyZ7ZTXVgQLOEGgNyJ36Lk43eRgSp/yHD+Hr5ntNqP 0hrtusX1XsJzk/T1H+8MixB+a2uSXn8d5ATq18f+KUbmliCQPF5/ndSMB+Uexn3T5nKZ O6VV3vEbFe0SBhX9wI1+d1kUeN7lfaD+GMoS+7aexVJtMapkbU9oB2HxCk7cdxUJp8Hq BDOvDJODsvakIKtMdCSvMngc/9sGz3b5dFy/zuH0090viSjG4wg7coDWmBgrmARY2t00 xqcw== 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=Fcw+rnXaXgcyJX17sjqoUMlhp53OtApWHOAkHrNoLB8=; fh=JEwbgsB86sRSBn4ghmerGxgfEqTnigm6+nu7I1SGV9w=; b=eudF6LJE9RaCzYwFmaJTw3RM7TTRtmisQKwyjtU8ugc7Ux4gP+PJx91oJ8jBMDhYbj MceFpnKGP2ssSdxk1xiEl3fdXO+fe+iBzOg12/OnGfI+4MQyasvnzQlKdnwEiPzzL99U VvRXp/nZlR8dcH9g2H2j70PVnM//JSrT80r1tdxMi2Yy5sH59eL0Zn1fYIiOqI17Q6i+ BBEDMU2pb/8SC4Lxj1UGR54bE6qASPEFpIJacMxZH1H+BSox8s21gFtTVO3T6ZQL5ARC 1AEtCxrXUSFizE3RZ3/qMH8nG1bFbV6+D7s+JP9g2LOXTHcn1oK7q8vTMbFARNJeHae7 7jHQ==; 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=1774335262; x=1774940062; 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=Fcw+rnXaXgcyJX17sjqoUMlhp53OtApWHOAkHrNoLB8=; b=LLJ1zsORS3GaT2Na90NfMDYnUwvyABZm3LehLLISX9W2rC2qxJzw6mkxB31nmk1/8y 25byyfUTcAJYWMOEwxGENYhUa/pYkT8yIM5bWi+GbmCN/Me/L5225viWOMWeMprDxYe3 NYOmr3h3q+MhDFBBRML50+6dIUJoFLhxGMqrCgaPwtAw+Fefz/KCSdjgwSrkjJVcgERW iTBIs0RD3nqpcJGdTlQyJ/7wFoK0LPJJ1xIHfH2DnWSy0VthiNXWiiOvu3ghrDhFpmra 7rqc0lwNSfXpthA79QtzzcXuWUOSWQfi00Nt9xXE3bwf58VG898gjHYRBsiWiyH0eVbg uy2w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1774335262; x=1774940062; 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=Fcw+rnXaXgcyJX17sjqoUMlhp53OtApWHOAkHrNoLB8=; b=Yf1tEkGbphYft4i2nkEfqPLLkKemYH4DMwXhtel/s3t0tmpqCJc9Df5OpXnpH6cX16 ctYWoPlg+N5iUQAjK+Qy+hDF4Lhy6YoaQiKYdRJb7tkifEi+rtY+fcaQmLYNvNBEx8qX 7Ai+hZ0nVYEHmees4PUq+mAgxUYTAroFK7kq7ZiIOZvXYqMwRXYykThqDzwRowhhb1ha Xw3oe4A47thOhTKJhXA7w5XcgB1CMA/l4wLdaiGjeu8tCmkNVlx+Z3BKOXuZcVT5pW1m 4EYcPVoeRjxpW0zfEgg05s/6j5yGZw3B7wvPCtLO/rj2FZyhEQamegixGvdFUFnFODpP U4rg== X-Forwarded-Encrypted: i=1; AJvYcCVIeLNKagJz3Rj+nH1p4GLpH1thUOba7PeSEZWUD8+/u8f/WvGJgICVXjkJp/tBGhCj6Art9fG94sdpwh2H@lists.postgresql.org X-Gm-Message-State: AOJu0YymqzddkH8AJQBjFn7y27TTV9YmOB2900XoQpLeuihsXlc5WMTf 0kw3IuXZftQWlNwluM7Kq/pKcFV7EGbqPWR0cnkCsE38HbMGgT7K4rWwoS6K32hSGW0yplG4UV1 838Ij86iXFGl5X3FlXPFSDLhe5G8MI18= X-Gm-Gg: ATEYQzzHfnyfPdhFBqv3uGNuqxI4SmK2HfYwTp5ogcM1eKovt4j0mkdpC6bK6kAjrQq idM29422LlXPw06lS8qGf8a/CTfNRA3LYC1QSWvEdUjPUualYLg0ohtQqn3jWygP1t2WVj32dYL B9ML6i801jVMzjwtvRW2b6Pj1haZFa7/stqOuUfrQobUl9WgwfKHVRP0qWa+cvpzIhR/0DZs/cR V5MXNRam2PYP3ryz+m4stavJcqyOUbaZLcGsdwZlik181Hywvc8MJ+ZVn794L0rz6YlUtF0mQkH +PIs4bnHOA== X-Received: by 2002:a05:651c:400f:b0:38a:210d:2cbf with SMTP id 38308e7fff4ca-38bf963e5bfmr30526131fa.10.1774335261685; Mon, 23 Mar 2026 23:54:21 -0700 (PDT) MIME-Version: 1.0 References: <0c28fbd1-3320-4e9b-815c-6d62753aa063@wi3ck.info> In-Reply-To: From: Ajin Cherian Date: Tue, 24 Mar 2026 17:54:09 +1100 X-Gm-Features: AaiRm53Ulwser8ed5RCPqzgviF2Vqo0R2ASxuKPY3cNeqeRdr08AM3hY2esWbMg Message-ID: Subject: Re: Initial COPY of Logical Replication is too slow To: Masahiko Sawada 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 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() since + * 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() thanks, Ajin Cherian Fujitsu Australia