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 1w7VWF-005O4c-0h for pgsql-hackers@arkaria.postgresql.org; Tue, 31 Mar 2026 09:36:19 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.96) (envelope-from ) id 1w7VWB-009Ii4-1h for pgsql-hackers@arkaria.postgresql.org; Tue, 31 Mar 2026 09:36:15 +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.96) (envelope-from ) id 1w7VWB-009Ihv-0k for pgsql-hackers@lists.postgresql.org; Tue, 31 Mar 2026 09:36:15 +0000 Received: from mail-lj1-x233.google.com ([2a00:1450:4864:20::233]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.98.2) (envelope-from ) id 1w7VW9-000000029Mn-0Ugm for pgsql-hackers@lists.postgresql.org; Tue, 31 Mar 2026 09:36:15 +0000 Received: by mail-lj1-x233.google.com with SMTP id 38308e7fff4ca-38cb8e42d1dso2808561fa.0 for ; Tue, 31 Mar 2026 02:36:13 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1774949772; cv=none; d=google.com; s=arc-20240605; b=WLicbu7eHtzJVTJndujsoVBW5AHkbGabyLuPWBXgKkaAbyUXxMi+AXh3z4jlayRCFO WtXH5Kmd+qHz51MdwK1A2lb17/GsM9fYl/l+DZgfjbcmqV2wqYYdlLDj9h07/9AL/0f9 /nNxfriSXsmlCfQb34dFZ7EfJb/uq1vuSHNNOq+QfTGwmemc0aPnZh5EmConr+KfrHJz auSSYxMrmGE6PW2ArTMXESUtIyzxwfExhXgqeDEUP9CyJ3/JP2Oaao7+/3jqgy7JniSi gENDV1PVgn4OtRunbc5Ie9h918jIlEXshwvbnpyB5OXgrTqxbNj6erPD0V/zxI7QQz6g BWmw== 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=oRqQjgti7snoWae9ZIiqLVaiLs9JqAGq7XQfU8+KyEA=; fh=8iAPridgx1st2skCvt18xSIB1+tVctd3Vvk6czadcX4=; b=JKSEJXjFePGUXwFjHXOhpUC7GdV0aajMEk/Dt4kNnEZzczmPdWPzy/SkF+lwNlKdxZ UCEUrd5IiDLHFnxKmYbJDQqOvFn7CmIwmt1irm2bxrPLPe9gMQ1O101cPPqCH7U2FPzK ZVSfhQO1fkA0cKbJhDC0jjSWj3mAt78T0xcvxEhBEFC6AsOfkU5uNVWRUVAMNfvguY8A N++XyNuTT9o4roDB5FK5oeWCPhJKD4jrhLt6idBAD5++ZCk5u+Gk5ZT/bGcbMpAWU55T 0BPPLHpJvWIdLYBjKGkdQA0KH4k0ml59oRfaiEKi3bII29HzRA44k/4oxGFvlS+vruUr y0Ew==; 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=1774949772; x=1775554572; 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=oRqQjgti7snoWae9ZIiqLVaiLs9JqAGq7XQfU8+KyEA=; b=NO6oun+IEFdXfB51Bx7lnc7hbDV4PaVGUqVsocOYRM1lrHs9IW9BMtd7fn4MoY1WUE ykv8fAzfUU8tOl2FwESQ9pcewVyMWzOHjujtx4KZxkbxDi+0QDj0oTuJHm7YQNNwjjB5 brapE0TSR7SASTjUtkcxJsQIAyEg5H9jxkp6I9O3tiMxBsUd5N7nM2PnnKhC8RABSZF5 56sLRZYi/esV/GwBIOTKHWuzDSIATiuMCNloIZwVaLjFxddpTS0KlOlOmt0HgDXkzME9 maYi8Yqn50GyWvozCtLnF03Hg75pScVuVhujNIC9WJ5RaU5rUKhXO+q80FnYsB6ICfYn kIFQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1774949772; x=1775554572; 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=oRqQjgti7snoWae9ZIiqLVaiLs9JqAGq7XQfU8+KyEA=; b=VaBV0rTKPU0zBnfwlI7LZKGa17OH0xI7zIKZJzSfnyQ+S0ks6esQM3WybB/jn42g2z mpGG1VO1DiemasjUXEYVkKR7Ku9fSS+oikGL1SSR9mgh/fk6V7wUUhTDqdJ0HSbn//JC IhdFe8QQzTVrjCrp2nqtDRSsD2dBtLp4E/9Cu43LUTU6aKwIVCMFJzMR/2eBRgLCtrOW jXTl8HgmsVJh5XAwPJm6APt984JKCajdw+VH42ucXiD7JHkod8YYb0ZLDcOAYgoJCd21 nj1Opy8nShiPIc6mKV9PL84YaFhWYS/oMOqk2BRmEmXpOuyOad/z9XtKsY7+1X+dSNma 1x+A== X-Forwarded-Encrypted: i=1; AJvYcCWWjDp4HiU8eSctrYVIKxZSyQD/bePo8+AOMYwy1gLY3XDHyO3G0RZVHFKC45aKMOPxDm6IxjtNwRN2Aei3@lists.postgresql.org X-Gm-Message-State: AOJu0YzgcXYLfKvLK2ptlmvhnTrhbI6AryG2UGoZLrgYSsD8P+ZmY97d EUFetvxkvJOdQfXKonHEpJbMcW7HNzaIbUU8bs8UTU0ouDgRv9vmJxvzYHDPrWPLGhQRTgVVedo y+c72kFbKgafvzmnCDcxpNV7/o5zvAR4= X-Gm-Gg: ATEYQzwBFsR1ekMIBnpNom7XHodfMY8wfiyufT2j/mPBaEA93dtxyAADcO/TPP9dzw3 WA8EUMdfgBEb/BrOMhhqIbk9plLoG/2hkxoqtqWbdQnfbWmGHUO8H6YVgAoaRq98ogJpO2obyhW 3Hp9A1WWjftmnjKIydk6wpWn4v3hVIMcAqQjzXgcRcPZGM25cqkS9R7lNV2o/SLr+Fb10fey2lf 8uE5Cg4srMnwxMOPOQnplqJ5iU81lHEUCtXSozzyfCr7Yxfag8iWRWKVDW9s9rJryTIVuNqiCoM rqZXcilcMWcp11+P4nzc/CdCowBjtDXeii/BlGAMo1SAwxI39jg= X-Received: by 2002:a2e:a99d:0:b0:38a:5339:e667 with SMTP id 38308e7fff4ca-38c731ea118mr64348651fa.1.1774949772154; Tue, 31 Mar 2026 02:36:12 -0700 (PDT) MIME-Version: 1.0 References: <0c28fbd1-3320-4e9b-815c-6d62753aa063@wi3ck.info> In-Reply-To: From: Amit Kapila Date: Tue, 31 Mar 2026 15:06:00 +0530 X-Gm-Features: AQROBzAaNNosyW-cE4-BEm5QI3waK9BeDUX4Y3tl_HQJD2asNXSFv-BNPOI0rmU Message-ID: Subject: Re: Initial COPY of Logical Replication is too slow To: Peter Smith Cc: Masahiko Sawada , 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 Wed, Mar 25, 2026 at 2:19=E2=80=AFPM Peter Smith = wrote: > > Hi Swada-San. Here are some minor review comments for v4-0001/2 combined. > > =3D=3D=3D=3D=3D=3D > src/backend/catalog/pg_publication.c > > is_table_publishable_in_publication: > > 1. > This function logic has a format like > > if (cond) > { > ... > return; > } > > if (cond2) > { > ... > return; > } > > etc. > > There are many return points, and most of those "if" blocks cannot > fall through (they return). > > I found it slightly difficult to read the code because I kept having > to think, "OK, if we reached here, it means pubviaroot must be false," > or "OK, if we reached this far, then puballtables must be false, and > pubviaroot must be false," etc. > I can't say exactly why, but I find it difficult to read this function. So, I share your concerns about the code of this function. Because of its complexity it is difficult to ascertain that the functionality is correct or we missed something. Also, considering it is correct today, in its current form, it may become difficult to enhance it in future. One more comment on latest patch: * +static Datum +pg_get_publication_tables(FunctionCallInfo fcinfo, ArrayType *pubnames, + Oid target_relid, bool filter_by_relid, Why do we need filter_by_relid as a separate parameter? Isn't the valid value of target_relid the same? If so, can't we use target_relid for the required checks? -- With Regards, Amit Kapila.