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 1w7ctc-005XWH-02 for pgsql-hackers@arkaria.postgresql.org; Tue, 31 Mar 2026 17:28:56 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.96) (envelope-from ) id 1w7cta-00BdJK-1E for pgsql-hackers@arkaria.postgresql.org; Tue, 31 Mar 2026 17:28:54 +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 1w7ctZ-00BdJC-3C for pgsql-hackers@lists.postgresql.org; Tue, 31 Mar 2026 17:28:54 +0000 Received: from mail-lf1-x12f.google.com ([2a00:1450:4864:20::12f]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.98.2) (envelope-from ) id 1w7ctY-000000020Dy-2kl5 for pgsql-hackers@lists.postgresql.org; Tue, 31 Mar 2026 17:28:53 +0000 Received: by mail-lf1-x12f.google.com with SMTP id 2adb3069b0e04-5a0fc5e2c59so6798523e87.1 for ; Tue, 31 Mar 2026 10:28:52 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1774978130; cv=none; d=google.com; s=arc-20240605; b=SOAa/wtbg7zY2JTZ4CzgcRCkm2uEw8fGIAu3cFRLLZ8HosRZyMCqnuwmoSBsPBya0p KvTJwUM/cFpsePE2BqMkr4FYNUfeWt5JzVcd59ScMhb9NsWQM2YUPLgY2twMwRIyrV7S a/5hsvNDTO7S7US2qojWTpOjrDsd6N862OncL5o4G/qwVaFzCfgf1Fx8wmiDa/o196C1 l5LMz5vCrtS2f/WRzSd4OUNJD9qb2iP8qX0H0wZLRawaMRXbXrfJrZLr8bsUw5PrKFay WP644BrY74PQA1vzvDuSTUnYeyShRVl62Gpb9oUlgngc10r0QTpHQH8KOrMv3xS7uh1Q eA0A== 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=T6tyOSVqiit3W0LdnoXTKwQ+lQ2qGAHy8P3lF80eQR4=; fh=4t6NX/Myy1BGeQcKU6dYlvZ4Ia7mhT9mg4glcmAU69k=; b=ZNYo4gZzA/6Unz9RcxkqLpXelz7mUbrFlmSDW0ovbgTsVJ6FhiMzLrb4ASoeu7xNQC kILvIKXeviy4cfd8sygmZQ8PLTQsiz1T60afQxFg+tf1b1f/TyLMOd4Lf9rGMu8pwTqn 3r7uMXBBh+gkwHC+JLd6UmhFZrM4OQv+QkKgBlwMQcIT7FPmNlBFntE6FEq9Fv0LuICu tKigUlBcZn1KhiBT7BKLtakx9nrEpUWsQslaqL40P06sE3coj7CAR1kXOijuqIyrnSEg psCQKQa7t1yeWviGie/NTwszxuaUSi4j19+xC2rVISLCMnfzSbPQOA5FTxy7MmraavU0 T3Gg==; 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=1774978130; x=1775582930; 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=T6tyOSVqiit3W0LdnoXTKwQ+lQ2qGAHy8P3lF80eQR4=; b=iBVEKBgXNhCMOQPjrTcv2dVx9VM7It3i5jCVFt0ziDyvwKhmdRszo4VLPi7cpSwWFv xCgASwkmnUza8yxRQVnJjWSn5N3J4wWIUrTqPLLwPvqaLWPVpsOzJkzPDqCuvM7fRaKZ puy7+djzc5mmIGbEozA2ptKPpFndreqadTK6cTt1uAzl5b0/+biKKuLvD0Wkbdynwh3M mAbGmtim0wXbBXP8PqHgepS/mDuZwBw4YbFSGIXHh3xIjUwtfy9CxsCJq1KAoKhQk+J3 nf6buANP1ZOTc47oMEA/dxUbc6pFcMmRLHZsq7ZVWhBO+YUuCytv+k8r0/AKLyhDZtGW Dfcg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1774978130; x=1775582930; 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=T6tyOSVqiit3W0LdnoXTKwQ+lQ2qGAHy8P3lF80eQR4=; b=jPgtH9UF8+HnPFBhXUc7abSWvgbMx3vRICijVS4Ti24rsCHU72BDzTSjz5b+bcIJto 7E4c01TFeWVd1QAnqRw4oIa7toIMMgsTA1KimFetksHq1an4F33CFzxNvepzXXBwBXdy My5jou/uZjkBewlQz3AWuUBmCSF0OQJHmo8ERMJxRRN9NGtxeOScnIY8eqHth2qR5S68 hLx48htfobrrJM5uTODwBI46XCv5QNli1UbbXyuR5vxJlwHX9Xm9Vs3Wb4p9OGZKETeL Mf6uzkdVSqby6hz0HTMhdI63sGm+o4eHFXqhKuWdYTcReUgvVmE/0V23xL64r6qC4LEf m5SQ== X-Forwarded-Encrypted: i=1; AJvYcCXRqzmJ01B0BYbvTghdrFClr+Wa1HRiN/oG5FAKkmXt5MhDrbEgS1cHEd4142t+5Fj6KaHS1d7ZAZdNwa7A@lists.postgresql.org X-Gm-Message-State: AOJu0YxTQLyKCUYZjN163h9II00i4bvSSBKz9vwjYnyNkCQucj23rtgc I9YfM3+TU+Qfb1ENE3aziy7PpWZEMoLLmKuTs/k3qw/mYv34Ig/w9Os/M3pcws1S/pXa3eqPLri KuPFLwyc0qkowbxJPII7/4ugFHeYW94A= X-Gm-Gg: ATEYQzwM5cibxkeAx3nCzB9Xi6pjwUH85MK2GXKRSPxYTfjrNmU6wMukUWyQVzuuVt9 MSfsvPjapSy/odPJPSjrWX1MMkRqQL64b68MoZev0b97N5sw+jnsSPrv5nGKeIhgASe26MtvKQa ZET7dncWIUbDZH3ZpcqE0VYmIDYSA63WZcwcnoIQ42qMX/QE8FBxQwOyoP8595BIq8ukyEK+lZw 2MyY3yRosnPul+etCzDDz5PLelNEhOynwc9gQkCX9nZ1qEA9Kfd1RqMIJmZtirPNsSC5cNAehrv gwr+7sB3NyTRnaIKxgT4PMV0AB0PDREvLAIqfvg= X-Received: by 2002:ac2:4e0d:0:b0:5a2:be43:c57d with SMTP id 2adb3069b0e04-5a2c1ef580dmr134922e87.12.1774978129538; Tue, 31 Mar 2026 10:28:49 -0700 (PDT) MIME-Version: 1.0 References: <0c28fbd1-3320-4e9b-815c-6d62753aa063@wi3ck.info> In-Reply-To: From: Masahiko Sawada Date: Tue, 31 Mar 2026 10:28:11 -0700 X-Gm-Features: AQROBzCnqvzRbipcKG9q7dwJQeX90oXa-dQM4HZ161WFFn4p9xLeHVgAbMUFOWg Message-ID: Subject: Re: Initial COPY of Logical Replication is too slow To: Amit Kapila 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 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 combine= d. > > > > =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. Okay, I'll refactor that function. > > 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? 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(), so I'm concerned that it could be confusing that the function behaves the same even though passing different arguments . We can check whether the given target_relid is valid in pg_get_publication_b() but we would end up checking it multiple times unnecessarily. Regards, --=20 Masahiko Sawada Amazon Web Services: https://aws.amazon.com