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 1vhtJE-0090Gw-0n for pgsql-hackers@arkaria.postgresql.org; Mon, 19 Jan 2026 17:45:01 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.96) (envelope-from ) id 1vhtJD-00E4L8-12 for pgsql-hackers@arkaria.postgresql.org; Mon, 19 Jan 2026 17:44:59 +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 1vhtJC-00E4Ku-2v for pgsql-hackers@lists.postgresql.org; Mon, 19 Jan 2026 17:44:59 +0000 Received: from mail-ed1-x529.google.com ([2a00:1450:4864:20::529]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.96) (envelope-from ) id 1vhtJA-001NDW-27 for pgsql-hackers@lists.postgresql.org; Mon, 19 Jan 2026 17:44:58 +0000 Received: by mail-ed1-x529.google.com with SMTP id 4fb4d7f45d1cf-64c893f3a94so9714608a12.0 for ; Mon, 19 Jan 2026 09:44:56 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1768844695; cv=none; d=google.com; s=arc-20240605; b=EAC+A8pcuQxaGQzORb/8M1NzzXiHmJ0H4Huq7IHg20FR5vhIu2DyWo6Vsl7uLa0L6r h0+cwBIKTlood4S7E4zIn3koAB6FK3hjSBBxXEvXaXZ+TOE6F/cCfBYsAMh2iH4TKUx7 LVNClx/CaKxgLAg7ubeYzbmRBd8DQ0PeWwDGIFmU9pzCb6ZFRL5Jbdg4HIyyP9UaTS/T W5/jgsCpNFnTO9YoHBhTmmaxAXdkeroYw1cZtrDtgtpNad2XAMZBqH+bRC9A7pyZLSoo 5ZoxwIiRak+DYhC9BfHD0lKi+MWMvsV41rcNfNpAt2ER3nv+HSJlJxgY0fo4zZlS7Rk6 OseQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:dkim-signature; bh=yovvnE4qSKgs9vFoyBnm1LmZOztoIOiiH1Oh8BU9YMQ=; fh=fydrzZs8zAhjMQSFf00ImYkP4ua4nOoBUJm/+FAod2A=; b=Hu9bT5aAC379gXXZEVstX7OJLLHSnq4o5JpJ+nf5XHRYeuMwetAuP6PoOLuxEAl4af yGWaIxyY5+cXEia5V2yjS4M6ciwpAVW03eY5gjSiHyJqDUDq+7MoW7+k5eoH/TTjYVTh NjFu3UtEP1ScCkW2VJMBv08O2Pbl8hrjC/mxxor6UCmI5juZYC5/PKa8sWGsXsLMJfAl meAS6CVuxwQZQ3cYWZiuTd0sBK6mJeyPKg0DEJEqWVYN0EQzJSuCKP5dvJp86VpWNzsr xVFCuZlclG99nPE61LHUqrgCg979CB4yBEexQKKP6jl3RRMjMLWzKTLN0qokr7Mwe4mt d9LA==; 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=f10-com-br.20230601.gappssmtp.com; s=20230601; t=1768844695; x=1769449495; darn=lists.postgresql.org; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=yovvnE4qSKgs9vFoyBnm1LmZOztoIOiiH1Oh8BU9YMQ=; b=gZBdnlrXvRcsujrL1cqfluc502GUEHfyQeH/8Fy5QUchi16OomTtf+v7M70Rayh7pA 41Mo/X256BYk+Fvjh7zaRXpbGdpUo3O+O4u/kx6NfgbWkTcvTLZD9RKMKDmDoCg4WVed xqLw/iSU5TYTVgEVyX1XTcrzLNZBR9uLgk3aTWVV2+6zkhAowb7DE5aKt8WoTu0cUUBf BnONgIYc064/fLl+4TfLyTqbne00swGKUedL+1yQi2CLrSL41scE3eScLtO9GqaGyTDb x6OQCH1kRDZEAYCwa7ooBTmS0vOYO1GeQgsjHV94J9+EEeU2sMig+HgfA+C2bHE4OPFw JKkQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1768844695; x=1769449495; h=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=yovvnE4qSKgs9vFoyBnm1LmZOztoIOiiH1Oh8BU9YMQ=; b=NXvKLTnv/87D9ZzwkBQH9CoayjEpcmmzZ/VpT947n/Z6cvkzm6sIWt/Gj0BWOp9/aU uyVTQS4+58G0a53QFpFFWcD75B+sqqz/i80I2jMRuG8KCMrCWsvfPROL/q6vuGX6ZwsG ZGe2FgvswP6cqiQ4yw3lcrjhi0AzSh/xK11NOphCOv1YdAF4gSQMDOp0p0zLp7L9AFRg OYcU6luLIsVDksDO/IIUzqKLtauDf3VXePl9qAT8nBadMVqoXWmB2jDHc6K6L+qn8l+S KSPUmjiDhu7BsHTqDoN3ItVnjaVdHcku/msKEONJACMBoq3fuQeCbRAxZu/ZimzeeHxV g1AA== X-Gm-Message-State: AOJu0YyPzcZHBJE1BLkIb8VTH2SfroxD8JCDnmOW8qqC2Q5JW/CuHo0s PXqvX2Yi6cm5j56hIa6lH/S8ZOBeOHxVK2tLhjn4YG33CKozb0877YdUHjjpO2MTtyn++RqN9VM EH2WvOMTK68Hh0CkEz8o6v9qw72ANQNvQH06Yf54S9Z+tFOlE+svn6A== X-Gm-Gg: AY/fxX6NfdeFcAgR1piMWeLlv6YTwDsh6IIUnBPO2xuaIDzsoCRIX+gw6MKSRlIrTp2 UPJM6y6FLzHGxVj9CNQ0AmFXEB+UGJowNFXMib0nbM/RwRFe/gFXsV0SoDXh1xg+OINnGGXyB9g 35Q1RpoAZ5Vq7z2NfSEciu1dpgd7RaTR2lcUOioSnCg3eV74uYy9N2zygPcU+mOauPB5rDSMpCr gYKkO8f8eg4yVaGk9n9iBgbWxu6iZp04OltTxxbl8bIPw5/W1aiOHQTE5vXO2yxAPpAUEsUGDcf bkRlVg== X-Received: by 2002:a17:907:bb49:b0:b87:cf3f:1a39 with SMTP id a640c23a62f3a-b87cf3f2646mr390271966b.25.1768844695135; Mon, 19 Jan 2026 09:44:55 -0800 (PST) MIME-Version: 1.0 References: In-Reply-To: From: Marcos Pegoraro Date: Mon, 19 Jan 2026 14:44:18 -0300 X-Gm-Features: AZwV_QgGw-KonIW5YdyPYyCT5Cciqbs-Sf9x1K1yTG8rYYEUFjCZdtU1n1k4ZnI Message-ID: Subject: Re: Initial COPY of Logical Replication is too slow To: Masahiko Sawada Cc: PostgreSQL Hackers Content-Type: multipart/alternative; boundary="000000000000b7751e0648c13fba" List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk --000000000000b7751e0648c13fba Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Em sex., 19 de dez. de 2025 =C3=A0s 22:59, Masahiko Sawada escreveu: > Yeah, if we pass a publication that a lot of tables belong to to > pg_get_publication_tables(), it could take a long time to return as it > needs to construct many entries. Well, I don't know how to help but I'm sure it's working badly. Today I added some fields on my server, then seeing logs I could see how slow this process is. duration: 2213.872 ms statement: 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) gpt, pg_class c WHERE gpt.relid =3D 274376788 AND c.oid =3D gpt.relid AND p.pubname IN ( 'mypub' ) 2 seconds to get the list of fields of a table is really too slow. How can we solve this ? regards Marcos --000000000000b7751e0648c13fba Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
Em sex., 19 de d= ez. de 2025 =C3=A0s 22:59, Masahiko Sawada <sawada.mshk@gmail.com> escreveu:
Yeah, if we pass a publication that a lot of tabl= es belong to to
pg_get_publication_tables(), it could take a long time to return as it
needs to construct many entries.

Well, I don't know how to help but I'm sure it'= s working badly.=C2=A0
Today I added some fields on = my server, then seeing logs I could see how slow this process is.=C2=A0

duration: 2213.872 ms =C2= =A0statement: SELECT DISTINCT =C2=A0(CASE WHEN (array_length(gpt.attrs, 1) = =3D c.relnatts) =C2=A0 THEN NULL ELSE gpt.attrs END) =C2=A0FROM pg_publicat= ion p, =C2=A0LATERAL pg_get_publication_tables(p.pubname) gpt, =C2=A0pg_cla= ss c WHERE gpt.relid =3D 274376788 AND c.oid =3D gpt.relid =C2=A0 AND p.pub= name IN ( 'mypub' )

2 seconds=C2=A0t= o get the list of fields of a table is really too slow.
How can we solve= this ?

regards
Marco= s
--000000000000b7751e0648c13fba--