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 1w4zI9-002mLJ-0A for pgsql-hackers@arkaria.postgresql.org; Tue, 24 Mar 2026 10:47:21 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.96) (envelope-from ) id 1w4zI7-006AJi-1k for pgsql-hackers@arkaria.postgresql.org; Tue, 24 Mar 2026 10:47:19 +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 1w4zI7-006AJN-0p for pgsql-hackers@lists.postgresql.org; Tue, 24 Mar 2026 10:47:19 +0000 Received: from mail-lj1-x22a.google.com ([2a00:1450:4864:20::22a]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.98.2) (envelope-from ) id 1w4zI5-00000000mEP-3mK7 for pgsql-hackers@lists.postgresql.org; Tue, 24 Mar 2026 10:47:18 +0000 Received: by mail-lj1-x22a.google.com with SMTP id 38308e7fff4ca-38a723b2b29so8273121fa.2 for ; Tue, 24 Mar 2026 03:47:17 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1774349236; cv=none; d=google.com; s=arc-20240605; b=ZZakyOosbjjZimnUyFJt9cq+exiBF/kKeOUNliZ+2Ul2+c5OzCGvKFYrH9+EdJ8253 aA9DTcd1Iyp4VxovEgTyf3UXPhpREZHFI/YuzKw97f9dFYn6/UtdUbUDhshfgBIw5BdB 3jFPJWAs+vhdOvzepQ9VAIRC5j7rIbSA2NF1JgbfB2IW0LpvRozu+LCCRAyORu0g1SDL ECINA1sn5ahcG51KzshB4YL2gpHaVqT2dLx4fwPi0KcfeJ8brV3VDUIQeRJQaUXWUzi5 7Z7HMUb5eTucVtnGfe8w02hs69L+Jx6t9Vr7W/vbHbzc1tU1Q2GjQX40j7DxMy908wMb 2Zlw== 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=lTMPgr+tJtg2LX5bBhdko0X8V+foGJLX4LWY6GKdUnQ=; fh=FzUX7sZfRxFgB0XPfEBNn2AceuvTJEe2gTEnfjklmiM=; b=k/j1GXYW+A63QHLLo8kFUEU7ScrCv1DsK+fH62aWYcXh7sVE0fyJrRj2aINV+AutlW hpvZGrwqHGRzrlYsWyoQEzJmqrh5WZB5Opcf7uvzSZSBgTwEYyeVaFuo8K0bb209gi8A ZH/Rh6GODVRkPMJU8UU9yQ0AkmgCcSC1JM+kOdQSeMosf7RgA2nfiWcFPQWT6vblBHYK dXkUFFVSoutVNhdf1GLwaVIr1m+UGgzblFUMEjURA6TtGhoYbhhi85TBq/6Q+yoQqVBA B7E9z5aJCaphkSRa2I2E/KcCA5yG3Z9TpDNUpwf+w69q8qy/q+PUpVHBlsBl9FmtLh7F gJTw==; 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=1774349236; x=1774954036; 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=lTMPgr+tJtg2LX5bBhdko0X8V+foGJLX4LWY6GKdUnQ=; b=D6OHJe3fth780ycED7jA9Uk/5+/rQbuBI7jYvwqamYj79IieZMJ0ueBRsf5AC/h0ix N9PI/mAwsIKBmAW5xcimtwTQHu+3xQUGYULHdhtQBeHXk+jUwFicR5W4ETLW7BSPse1+ WouCf0W+wMZrlEjar3uDW+nann8twWXctL612VjKhcIcF6K7kKZqNC8eCeWtJDli0/BZ HhMtDz57BKNab7nlidH0ZOZRFIF0QxB5i2b8cIcCZ9V61KxLcGeGc648SVtN++dA3Ly3 v1oNceXcEN3moU+ry2Kw9XaqK6hsrahpyDdqtT1IJH4zyyuXZnSWFubX7g5J+zKagk9I Bsfg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1774349236; x=1774954036; 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=lTMPgr+tJtg2LX5bBhdko0X8V+foGJLX4LWY6GKdUnQ=; b=HYkcDP5xTR/eU/ahNthlXqczGVAbgB4u3ZUBJECVSHGrfJ32toBkSMhsWwOigRQNDA CExqUS+N/OhgBlfCQM/ckmFKQ90C0ZC/MFLy+AJejrSwgYTVgHnrQ0h/RvO6TUaAlzTc fRUUo2K7es6LszIJRF23wLEuxorRL6GQXU8v1W2hpF65Zf5xC7BNMUt3tmNXUeMDGX/f jq/ave/b6GqD8TZ4qGWKHzzBJAX3aabGEcyUrtQcH7KGYklPSCGs7UQZuizANOVivS0t qVlOninM/nWDWtPjWxlVfftqWmY2UmcpgESFThn8UrAeS2NRBdgzd0ucank0M7VyZdVH QQiA== X-Forwarded-Encrypted: i=1; AJvYcCUo4OpAZvdQ3/rOJU57efiXl9cVxCdcKIrvAyIEUt0uz9W1b+iL86v0jnYyvB+ymmc/6VPm0uGOyqu1Mt00@lists.postgresql.org X-Gm-Message-State: AOJu0Yw3vrhPRVGfe6ptfvU5bhFHOb2US5JBfNGMJ+WphVX42Obkt0uj rBxVb60aoo8YOwIyt31GWrvisScJ61t17wIpbme3DlTr6keQIbQaxtbo9tvY4OqmnIhroJHE5sY A4RURYEQGPbpuhG/HQAH12LFWqKa+ksg= X-Gm-Gg: ATEYQzyS12G/KBpWL+vge2tcvE4J7n0i/ptQfiWqXGdC533MrPj9GQjWj18bTtKBbEh yx2LkXNLkbi1DX3r+uIZm4eBSK7TP87EEccKxF3rSiOiIpsnHaSX/J7lHYa5EMpD4fA2nFZSnwj jbOFpucDJMK4Cu4JvdMNRU+Bp1rcEcjmT4YdgIvVLls6hFRAZZRWp97D+qv/clwezEjxA+YOGxf 8fTBRM3bVxASfTrluqSH1BEAV+wngrtaeu1WYj28wyUQRdjLI4fRDNMvXHZnhbb9Dm9hIyEI5MI P7WwsiWxFJydq+pPWNl3PxfrtGpjisYTGKcpm3Q= X-Received: by 2002:a05:651c:3243:b0:38b:e611:42eb with SMTP id 38308e7fff4ca-38bf96167e2mr53639531fa.3.1774349235899; Tue, 24 Mar 2026 03:47:15 -0700 (PDT) MIME-Version: 1.0 References: <0c28fbd1-3320-4e9b-815c-6d62753aa063@wi3ck.info> In-Reply-To: From: Amit Kapila Date: Tue, 24 Mar 2026 16:17:03 +0530 X-Gm-Features: AQROBzBGqQBCcXo76mTIDVk1ZM4xem3rInYfKCj6CscQrSp1kWj5WU6vc_WO64U 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 4:59=E2=80=AFAM Masahiko Sawada wrote: > > On Wed, Mar 18, 2026 at 3:31=E2=80=AFPM 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. > * + /* + * We can pass relid to pg_get_publication_table_info() since + * version 19. + */ + appendStringInfo(&cmd, + "SELECT DISTINCT" + " (CASE WHEN (array_length(gpt.attrs, 1) =3D c.relnatts)" + " THEN NULL ELSE gpt.attrs END)" + " FROM pg_publication p," + " LATERAL pg_get_publication_tables(p.pubname, %u) gpt," + " pg_class c" + " WHERE c.oid =3D gpt.relid" + " AND p.pubname IN ( %s )", + lrel->remoteid, + pub_names->data); Why in the above query we need a join with pg_publication? Can't we directly pass 'pub_names' and 'relid' to pg_get_publication_tables() to get the required information? -- With Regards, Amit Kapila.