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 1w7nl6-005hna-2H for pgsql-hackers@arkaria.postgresql.org; Wed, 01 Apr 2026 05:04:52 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.96) (envelope-from ) id 1w7nl5-00Et7e-0U for pgsql-hackers@arkaria.postgresql.org; Wed, 01 Apr 2026 05:04:51 +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 1w7nl4-00Et7W-2j for pgsql-hackers@lists.postgresql.org; Wed, 01 Apr 2026 05:04:51 +0000 Received: from mail-lj1-x22e.google.com ([2a00:1450:4864:20::22e]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.98.2) (envelope-from ) id 1w7nl2-00000002ISj-311R for pgsql-hackers@lists.postgresql.org; Wed, 01 Apr 2026 05:04:50 +0000 Received: by mail-lj1-x22e.google.com with SMTP id 38308e7fff4ca-38cb7ce7fd4so14227851fa.3 for ; Tue, 31 Mar 2026 22:04:49 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1775019888; cv=none; d=google.com; s=arc-20240605; b=i4G/EyZKwTFc+/p7UY1UWUftqVHtT8XPdiRHJyV2dk3wW/5BPiRQsc/oobsIGesJtF rTyL8eSw1wyfIolZWMvAp/IxfVsuXfy9FMmXgxvb7WO/hKAP+Q9CkMDZfYSwbOPMZKnh FMLQTG5VeHRufarf15nWqmiCZ9UQRrbmQSxdSZ2txtHic1GZzkJm/16wXE3b8/OC2ey4 5Krn0vwHPpsCY8oXbkzLx6vsnWjsyi3e+BU31DnAj2MTYluoV4ymI0SU+upnZWGGL/bG jEe4nefFXmcO18pngjNkXML2qfar32OhcrAJ8p/VaVhufwAYYw9OkG1DF5npJti8RLUV YhaQ== 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=7XsWVvmQqb1pFa+iwvHT1FwvifUj8xfc1MPyGR1mvb8=; fh=QE8JGHY7GwgOpgY4KzZ5KuO99t5pib+m8gAKdIXHULU=; b=VSwTFmjHUamXDWMVWJXqrak23fobxIKVb4pZKRbQ/a8mbjGdYBC/hTrua0B/jP3oHg mkHqf7LR5YQNH9LMcgTW5h2GlxRp4/m06IsYaVlT6Yi+XyRl+8T4H2qnMUVTwtxLgFsG m198ELieZ7A7PjVaLUEeeWsvuvl4xskw3xT1Lp9CcHc/urGT8LhKJTLn1tY4TRxrAFuE zxb2+mdJLPEs+IP3lObQXQbVvqOgqLnha8HKlPpnU7Js3Lmi7yBP3mQNa8lt0OrE8xQS 1axXd86eakTm4n6l55xUST+lfVbnNTkSNx+P+7I5mrKKCAXnjeOV2EQfwzaIG8yeJhWH qgvQ==; 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=1775019888; x=1775624688; 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=7XsWVvmQqb1pFa+iwvHT1FwvifUj8xfc1MPyGR1mvb8=; b=qp/PWwUBt7VXA5vVKWCtgxX+zVBkFD4DW1xAnq1+n6utZorMPVvPZovfOlUQdGN89z tR87wT77VicxNQc/OWDQ4wBwwON1iZeQiyOaturQ34Uvy0lnp1UeHGjzpDG1yyzEQEI8 5QdVBQbPoSJDTnUvzdX5VGpfLEppin/ckekDzKe7uCsI19v0S7NXXfHGlJFCrwmexVW7 KZMcrlHf7ilIeKdS44Eqn18y0RgRLIdVV2ylNSUdZm+u/Tb9LDnxY4EhBK1mea545yKY YtwRkpxAi/nHJt/G/j9EDi2kCTrNYe/WyizQZzgxePOMK9QZRrJuzl6yh7hC6ideWOod RKpg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1775019888; x=1775624688; 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=7XsWVvmQqb1pFa+iwvHT1FwvifUj8xfc1MPyGR1mvb8=; b=R5bEQYyk5YWk4/fjJcaAWvYCxez3SbCLKaAGjy7B4XF3F7iofvDF0yr3Lw4AaCiGSb 1KB+IUP92d5f8aw3Tf+9M6+x70P912nGDdXOn9vpXRLauIv06H8V/DtcYWgH4UVSzwdL n5fc4Pz9AENhf0ze4PT5rjYbCGHj8Bh43S/Iq8QYfNNi1LOT2fZfZpbzjaSSF6sOPgMn NunMGExnHEb7kMpqkYz2nfQzu1gQ6JSuMYXW8ckXk3ZG9A7RT7KPtrUbAQqSGT7W/edh ixludaj/AnKIHOqR9JdXuSc6fOgwhwYh0/78f9r6KFPSXEHpGfdjRUmOK6qW1CEvmObn rk0w== X-Forwarded-Encrypted: i=1; AJvYcCWyA63qqELsxWlyBP/fnkP0BtpGydRnn04grxjkBL8hNEJ2Pq+WgO7/ACOflj5nYn+ny3Py72Hno4Jqkz1r@lists.postgresql.org X-Gm-Message-State: AOJu0YwPpCYtnScAE17Nom3xQmZsVOLZ3wetUt3g6w6/49BDGkgk4ol6 hDH87YDUO3bIs8yv2R/d0FhB+79Db+hmENfOrljUYdo7suKkDRAuLS6wfaaVsurB0tHVhCqI5Qh g38bWsYYlBUGYII41BmlNGQThqamyPp0= X-Gm-Gg: ATEYQzweU3KBdLr22cg3c0OUBjm5x3/JsKLmUHNBaou8lCWbc0wsWLGWyyhgv2u7KUP 3ysSgUnntMjbJ3oq9ftnM6ofPi1G4iT3DTduA7KqQpwim5LblkXsxk8dBpElTR88jmxhFaBUYaQ EOITOQaGaoWR404Pgw4W8gEaZMO/88yvNg5nMKzUi4P21KApGQOC97QLLvqwdntqV//Pmewahcl vS5nwR1TV+CTXEMVPONfapMNsXv6Sj0v4LGvt/SxKv6KVgaMSWp9TKv+79CFcbBv1gI0TzSEOQC kApzaHOLYn/zI2vthiERxWA5lvcxX3Fkv7U6LA== X-Received: by 2002:a05:651c:2c9:b0:38c:125d:73af with SMTP id 38308e7fff4ca-38cc2f5b082mr5654351fa.11.1775019888055; Tue, 31 Mar 2026 22:04:48 -0700 (PDT) MIME-Version: 1.0 References: <0c28fbd1-3320-4e9b-815c-6d62753aa063@wi3ck.info> In-Reply-To: From: Amit Kapila Date: Wed, 1 Apr 2026 10:34:35 +0530 X-Gm-Features: AQROBzDq-J6CcakNG99OHLPa_mUbb2rBxG2Opqz4CCYMLHmRlxkGYS-CO8Jx0lM 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 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 combi= ned. > > > > > > =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(), > Isn't that what we want when a user passes InvalidOid? What is the expected behavior in that case? --=20 With Regards, Amit Kapila.