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 1w56ha-002ttq-33 for pgsql-hackers@arkaria.postgresql.org; Tue, 24 Mar 2026 18:42:07 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.96) (envelope-from ) id 1w56hZ-008Qsf-1M for pgsql-hackers@arkaria.postgresql.org; Tue, 24 Mar 2026 18:42:05 +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 1w56hZ-008QsW-0B for pgsql-hackers@lists.postgresql.org; Tue, 24 Mar 2026 18:42:05 +0000 Received: from mail-lf1-x12d.google.com ([2a00:1450:4864:20::12d]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.98.2) (envelope-from ) id 1w56hW-00000000vJU-2YL9 for pgsql-hackers@lists.postgresql.org; Tue, 24 Mar 2026 18:42:05 +0000 Received: by mail-lf1-x12d.google.com with SMTP id 2adb3069b0e04-59e5aa4ca41so4489359e87.2 for ; Tue, 24 Mar 2026 11:42:03 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1774377721; cv=none; d=google.com; s=arc-20240605; b=Us6aLJlAQ5E80APOSYDg0pGvaEikIY3AP70sndEER5JSs+OF7zQ9PSJhI0JiJMceYD J9wQdN+LmnAh40COtcEqceRTqj4WCyVQ5H4CiApQiTgcjCyxkY9t4tGso1go7K7k1JjC ZYolYJUKwzknvF3DRgssr/3x7Il28bKm83qhKlJviZxnVOqlNxiG6BdYRTo+FzdPbzNJ MfM82x7V+qV6aIF7JhzgGb6A4FU1VTukdgbsL1mNxbXQoOtYMJX1TF59p+eCjU8d3efx tccffd78LPu0H+Mfg4shDYSHWpMsIsoeh0qBtWZSTGmIMmxDx23w+6Ew9AjKN9liPJpV pQhA== 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=25WETQa4Sfb3+hP5eYDFqvMr3K3r3FEOBZLfNiEySgA=; fh=z4xiK21vtAIK/4MPJgNm9IT9AG7/GX3kB3u6R1uMz6g=; b=cdXHVY6ZXchQ2I/yKo/w4XkfkT5fbxF5dQzuPmwfaB5cnrSq6wDxbiHAB05i3uVC84 uRBWE+zdG8LG62n+bsBkSM88nllgMg7y0ctScuQMJdiAWxwWRtMDwQtryBa85a8tQNNq 1NRrJ4Hi8vweGE1C1VxZWm5jFvtK3RFRCvHY1gkYz7KBfs/2MTs50fwRx/B+hNLLNdJi uQVHxGW24LlWf5ZHYDSofjhCB53joc23zNloZcApFHdEV9P1N+yij8xykq31KOpCs3bR bJ6RXTGB20A/wPXD/0zv8mAeTzDdfPdlr/3MBrCmcpN3MAnbILcDiXZU1W7yMbXX0UUb 8+4A==; 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=1774377721; x=1774982521; 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=25WETQa4Sfb3+hP5eYDFqvMr3K3r3FEOBZLfNiEySgA=; b=Aq2sXiQJD19A3gPE9OducpunlWO522jbOSPfNXEB8I/Eq8REKR/jl9pWzrup5z0Syh JA4Og8PSjqc6M+UY15SCjzpBW4AjDXG0wtVD5cc244gMgDaSKyDBPleZBnV4R1OOrC9K Ql2qs8I5ut7Wb6KWr+ROHp1frCTFb4ZG+FwN2VcT5clUry+yUu8uIVPlrqfvnCpuysru nt53P8QbXKoMIc0eF2ZcvsOYpc5IBxMKj3j0dBBb6za8kwcO5FrXd4tUTNk462ovP41d XPge3Zo3p38kR91gXUa8DM/fH03rL5VCk5c5mKychILLK7J2mZP9wYjkwf5LZQ1oXdJ5 wVSg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1774377721; x=1774982521; 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=25WETQa4Sfb3+hP5eYDFqvMr3K3r3FEOBZLfNiEySgA=; b=fSj+VYTK0qkGQGJj3bPTeQB5U+qYb81Xs0JVFKL78qBZw3JjKZtPf+QmkyTs/tzcHu 3QLApODTLlzWRTYo+GzSJh14sdTnrkNPmo+j4htGOdLs6gX9nW4r24w0rjSe+v/qvRqI FB8AURKRT5uyFUbxNoWVBkxHTT+fTvIvW61P6hXGSKtZBor0toGRxhdnCIbIZenWNbiy L5tqZHr079HLbk8kMSvLWXUOcD1WVVzI1kxM0882PydrSjf/eQIutsUWt8OwvjNHF83L N6OjUHqSZETbYAsXuTk8wBcKKlENGcYrXVSP7IbgUTevOb+hLlGejoSpurOfv9oxSdIF IJxg== X-Forwarded-Encrypted: i=1; AJvYcCXkz4Fu+Pq4dyXr5VRfsdhCIUND4/6jqE67L4c7z6ORtevIVENJF7kl7mKOvgbeP7tKZHhheWeYjtssUbh6@lists.postgresql.org X-Gm-Message-State: AOJu0Yx60TRKil+RYJJd6rANt1V7aPsAzpD4Fxk7ohm8M7c1sN3Epsqy a+asV4ufEAfmMAHNCKBwZpZhmi2XXICy4wzlwHsj9RMmxMOlSlWdbUie+jnxNiMYm+FN7eqzInc xecL1/cIBjyURuMNpuQK1WuWIGFm7PHo= X-Gm-Gg: ATEYQzwjaKBgspvVSG1MAKwofL1nxvIgf/AVikucYjeJca+IgyzFqAFF9eRmj/AGUIz FWvhnUhcGtysuOedYjE0cxiriW5pUu4Sr8Ra4UdDX1ssEu0QW7Mu1zvwNoR5l2Ot0bs4fpSGVfT Qg9EjJLJav38RnYoW5f/ko1TB0T6RbzOl7S7+xdxlsV4P16JExQsP2kplA+JfSnfIhD7K0doXhk FjCrcZP2nKddir70rH6Nsumhs3gDDH5m1584dS0rDluo55FQwZDgf4rIKx+rE6RE/MJJUQVn1Xn LR5y7+Jh4IZGzOdYnD2YzSYIAl77rsHikFBqnfJBLM6b6g5y X-Received: by 2002:a05:6512:a93:b0:5a1:3fe7:44c7 with SMTP id 2adb3069b0e04-5a29b99360amr221708e87.32.1774377720998; Tue, 24 Mar 2026 11:42:00 -0700 (PDT) MIME-Version: 1.0 References: <0c28fbd1-3320-4e9b-815c-6d62753aa063@wi3ck.info> In-Reply-To: From: Masahiko Sawada Date: Tue, 24 Mar 2026 11:41:24 -0700 X-Gm-Features: AQROBzBLdh6sbCgHQpzaznowTUtsSGdWEI_7J_Ze_f6sjmUWKPir7G-lQk9HYh4 Message-ID: Subject: Re: Initial COPY of Logical Replication is too slow To: Bharath Rupireddy 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 Mon, Mar 23, 2026 at 5:54=E2=80=AFPM Bharath Rupireddy wrote: > > Hi, > > On Wed, Mar 18, 2026 at 4:29=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. > > Overall, the intent of this patch looks good to me. It avoids the cost > of the table sync worker querying all the pg_publication_rel tables to > filter them out later in the join. > > I quickly reviewed the patch and here are some comments: Thank you for reviewing the patch! > > 1/ Typo: s/pg_get_publication_table_info/pg_get_publication_tables Fixed. > > 2/ I think it's good to have some quick numbers on how the query > latency looks for pre-V19 and the new one that the table sync worker > executes on the publisher, say, with 100, 1000, and 10000 tables at > least. You can refer to the performance test results that I previously shared[1]. The patch I used was somewhat different from the current patch but the performance trend should be similar as the both are using the same approach. > > 3/ + Assert(OidIsValid(target_relid)); > > Why not error out (by treating it as function input parameter > validation) when target_relid is invalid because asserts go unnoticed > on production systems? Agreed. It would return no row if the specified relid is invalid or there is no corresponding table. I'll share the updated patch soon. Regards, [1] https://www.postgresql.org/message-id/CAD21AoDQM62GOtaTzD_CVMSsFhv6o9c0= Au1dSM1QuxeKFkWAKw%40mail.gmail.com --=20 Masahiko Sawada Amazon Web Services: https://aws.amazon.com