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 1w8Abh-000Gxw-1E for pgsql-hackers@arkaria.postgresql.org; Thu, 02 Apr 2026 05:28:41 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.96) (envelope-from ) id 1w8Abg-0042yc-08 for pgsql-hackers@arkaria.postgresql.org; Thu, 02 Apr 2026 05:28:40 +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 1w8Abf-0042yS-2J for pgsql-hackers@lists.postgresql.org; Thu, 02 Apr 2026 05:28:40 +0000 Received: from mail-lj1-x229.google.com ([2a00:1450:4864:20::229]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.98.2) (envelope-from ) id 1w8Abd-000000008ws-3GPg for pgsql-hackers@lists.postgresql.org; Thu, 02 Apr 2026 05:28:39 +0000 Received: by mail-lj1-x229.google.com with SMTP id 38308e7fff4ca-38a01c80c34so3029931fa.0 for ; Wed, 01 Apr 2026 22:28:37 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1775107717; cv=none; d=google.com; s=arc-20240605; b=Cs9cAFmH03meLlwG2FoQhIIIGS2d1eVHraMO5OZf/Rfdm2/hrAAswJr4cNEQCYUvMq Oar02tm4+K1Ae8aRbkqCuKsZwUByjckwdh+/O1wH99Yh64TqDlzDDjbVTo+HEyPMgEBP E/blaayZ9zvvjezVeqAPMXu0oeN3GfhwYZsM8ZUqlmgZCrOXYW+WXBJ6G6qRmODEiptu J/6Txkg5RKJZ4uT/auo37bTqKlttS41523fr3fRElP8TJEpzeeUVzCwnOmzdPvCDjgZ5 z7secH9whno32La0srDHlpyoa6d9l5JL2Cuu2NmlTX64Gl3Hu5iWfC6gaBetSYpwloPt 14cA== 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=UPDTTNAi17d5eMU6p3ZqH3K3HwFnI/RaDyoz/382S/k=; fh=QJvVr1lq/a5xF43DpUb1cDz7YHozQUYywlP56AqQpeg=; b=RlW6tYiM3+PwMEjeINVZdGOfcZgfCgLyDrg1zE76QQ0EOA++C+tOI68PhsSRdxS4pn j51JJI+pLJZFHr87ewUNjrNHkqImaplmBPxDvaqqldAVgu9BT8WVKhhD+09bWHCY3Fts cZ+COyk9ILq47yfzm1JVcjYuYPnZRENhaliJukkezjHeBJp4fckJGqD5ueQOM0xWyU/V Orp1vsoSyfh29eCN09HtwcLBiRAbDfnCMEF0W9zllnGLRaCdRabutaYH/2PA7Rkapufz acPf+BOT85PaG567c9Wcakj0aq4edAl45WInz+cP/8+jzjS767evzrlLNVwb7HvEfqIi phMw==; 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=1775107717; x=1775712517; 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=UPDTTNAi17d5eMU6p3ZqH3K3HwFnI/RaDyoz/382S/k=; b=R96p6DzRFEJlWTu/Jww1RVkC0bbNSmeP09osCAZ4LMdyf0CYk0SLPKLJ+EooHkDfib DTL+XWvq/czSltq9ZjabYcBoFOYJ9cEePSZht2Wq9XD59LAqPY4lNpmqPAJTpIfJcuKh bKRHli3yxJF3T6na+q+Yc+bujTcPbMUsFup2J3iyQarehvCQZ5Nlmp+KGQkpkya5CP0z flzTu57MGjXJkfpCqvNhqbVIgz/yVdaydP72AeB16FCcdNg+gknjIyOuC2GKIhhX4plo wmTTgQEKmhbS1bwb1IFM8lWsVPekG2LGg0PuvH5Whv8YS2/P3Fi6rTE++hDklOA+/YHN L/CA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1775107717; x=1775712517; 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=UPDTTNAi17d5eMU6p3ZqH3K3HwFnI/RaDyoz/382S/k=; b=GHtn0tbVICBPLBMxD0ioBjRihu2GLgDRSSCmswpC3IUR22fNqY4puhAb/yrX/XuTkw Emptg/+OKgeG/Gsu0mv88Z5PKIg2piZ8QRT7yRMi4dObAd+mzY0dc2Tzu1EXBk9OhVO8 MevPBrRZmZZZpe5Au+gn3dzPB0bq6HKd24+Dvgx3Ncr3K4rFYU5wB4mBRlIVRqgt2Xhu wX/7PJwavTVcBiu6JbGaA4chvlqjhOc3+CHyZHiVTp4PR1RV9C3Q4nV8l1CqD2AVOlV2 j2LkeWKe1uhWrWPR1KpbSn+TpC9Jb0+Y3vj6wIdFKz501Vg1UtYdex5FS0GtZXmBgt+/ FaoQ== X-Forwarded-Encrypted: i=1; AJvYcCXT3+oQ/X+an4w7f32/zfZYE4QT4VA8LLwiQKVPU+41yNqYiiiD2XseNrjrlhHL0LAw4jbNmr50jrxILlnX@lists.postgresql.org X-Gm-Message-State: AOJu0Yz6SJvkTSEgkXjHnGsX/UdR2bora7EVC5YjCVXcecbwrVIf4tRT YhzAxL0zGHok+wa/wqA7O2pt2asLQkbc/sfjncsP7A/AicYeYpqbALHXJw1KzWLSN/fiZVXPXPm pJscmONSOc3TSaENGLWgKdF8WM4yYPRM= X-Gm-Gg: ATEYQzzfdTlKL8TBhwPcpAacHqsIFdvlltY4pVzwvFUiF4s3PW7gJQYmAGgBJrNa1OT hB5HAUOEJUO79lFlYvoGxtNkk+tYTczn1e/gf7fpGlOLOZHPtckDrGpfx2lIfW9nxTcvZ7gJF2y CzBsk/B2y4ErPQgy5xxT8W/JLCD48f+7k0sbvkk5Ybo40zz8WPw0az9XUTnROwB4T4LbGWOJ7to K3DnxJYRNeYdRPO7Tr3OIpZAg29q+SWrx+drR5veyGCUM4RkrPcXfNpnUl6l5bXyobRNoOpYV6j kb4yQY9W827LAVRpQNY8Azpl2+NEzoJ1h1eO2807 X-Received: by 2002:a05:651c:25d6:10b0:38a:f5a6:9178 with SMTP id 38308e7fff4ca-38cd3847799mr4810231fa.29.1775107716465; Wed, 01 Apr 2026 22:28:36 -0700 (PDT) MIME-Version: 1.0 References: <0c28fbd1-3320-4e9b-815c-6d62753aa063@wi3ck.info> In-Reply-To: From: Amit Kapila Date: Thu, 2 Apr 2026 10:58:24 +0530 X-Gm-Features: AQROBzCS2VcTGo0cv3AJdn51llBC0hSiXHLbL0-V1Ctfjrq5YT2QED4hdvRERxQ Message-ID: Subject: Re: Initial COPY of Logical Replication is too slow To: Masahiko Sawada Cc: Peter Smith , 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, Apr 1, 2026 at 11:06=E2=80=AFPM Masahiko Sawada wrote: > > On Tue, Mar 31, 2026 at 10:04=E2=80=AFPM Amit Kapila wrote: > > > > On Tue, Mar 31, 2026 at 10:58=E2=80=AFPM Masahiko Sawada wrote: > > > > > > On Tue, Mar 31, 2026 at 2:36=E2=80=AFAM Amit Kapila wrote: > > > > > > > > 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 c= ombined. > > > > > > > > > > =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 canno= t > > > > > fall through (they return). > > > > > > > > > > I found it slightly difficult to read the code because I kept hav= ing > > > > > to think, "OK, if we reached here, it means pubviaroot must be fa= lse," > > > > > 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. > > > > > > Okay, I'll refactor that function. > > > > > > > > > > > One more comment on latest patch: > > > > * > > > > +static Datum > > > > +pg_get_publication_tables(FunctionCallInfo fcinfo, ArrayType *pubn= ames, > > > > + 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_re= lid > > > > for the required checks? > > > > > > If we don't have filter_by_relid, we would end up not filtering > > > anything if users pass 0 (InvalidOid) as the target_relid to the new > > > pg_get_publication_tables(). This is the same as the behavior of the > > > existing pg_get_publication_tables(), > > > > > > > Isn't that what we want when a user passes InvalidOid? What is the > > expected behavior in that case? > > > > While it could be contrivarsial what we expect when "users wants to > filter the result by InvalidOid", I think the new > pg_get_publication_tables() should not return anything in this case > rather than return all table information. I think this behavior is > consistent with the case where users pass non-table OID to the > function. I don't want to make passing InvalidOid a special case in > the new function. > Fair enough. I am fine with this definition. --=20 With Regards, Amit Kapila.