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 1vzgHj-001DbY-2X for pgsql-hackers@arkaria.postgresql.org; Mon, 09 Mar 2026 19:28:59 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.96) (envelope-from ) id 1vzgHg-000aAg-38 for pgsql-hackers@arkaria.postgresql.org; Mon, 09 Mar 2026 19:28:57 +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 1vzgHg-000aAY-1x for pgsql-hackers@lists.postgresql.org; Mon, 09 Mar 2026 19:28:57 +0000 Received: from mail-dl1-x1232.google.com ([2607:f8b0:4864:20::1232]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.98.2) (envelope-from ) id 1vzgHe-00000001ql0-3QbO for pgsql-hackers@lists.postgresql.org; Mon, 09 Mar 2026 19:28:56 +0000 Received: by mail-dl1-x1232.google.com with SMTP id a92af1059eb24-128b9b7e3edso3543956c88.0 for ; Mon, 09 Mar 2026 12:28:54 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1773084532; cv=none; d=google.com; s=arc-20240605; b=A3AIdbgqTvCRY2EwfshLX09mguUsuBErPrVXZmLMAiMveMUUw9AmTWPDD7XpTvAcRJ 1ThPpiV+AsLWCNNShBRiK7gx6RUVRZpVVm2FvHR/uRcL5E7Uej5A1Q3QeAQhrShRBD4P f3Rs6qKXb27yIrRGDttuJTzSS2bcLvoFsuYEAc2iQKLMNYNkG9xUWwFBfnuHwFwA9vm6 JaIsBVm7vV0D21WeDg1bISIV7KUbuA2CfY54N3Uph99DV3Rb3rQLEooPUVd3duaI/rG6 wQlFlrA9PcI+HQhNHbmDsJdSnOv3Rux4/qkx9OpOB+upDrtb41QL1JGSKjl1WGPsQWle KuwA== 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=QPkuWQ+EH6C/B2ZBGIyb4xSDYFIepoBMYztPVZs3kag=; fh=NrVuv9BMg+LBf1xpuZncUO0myVDJ71Yw4gbYP+awp60=; b=dsow+ND1/f1s8TL16kVCB0e+5edbnHAFqtg5bFQP5Qy44qBarfVF+KW++Wzh8EulrJ rUiUVxY45yGHLqqGjdq1ngKosJAEyXAIEVMMKkXWMApFmcxQhIvieK71THHOCzaB3++j DFu2+OPCU79qLzs4xcgXx/tZlwmb2dMBhII3KLjBlGTZbvaERSiZRyt665LM0YXKpe3O cRpk+n2uxovrqyxbBoJ0JUgBdG0T3l4zCxUZ9SslTWvZV+caRzOl/tegkWk6cSoXw9Vo 9E2LAKFVXuKUyiOsQjE12zkzPc7cDW8KHhnvMZWE5uDe5/uYka++q1WCQv9M11ioMZFv bzQg==; 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=20230601; t=1773084532; x=1773689332; 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=QPkuWQ+EH6C/B2ZBGIyb4xSDYFIepoBMYztPVZs3kag=; b=cVRTp/9UoiD3OYbe9FeGcYxKxBFsMHtL9v7Sry2TvaNg8PODUGXjREx2Em3zTqddUO zq4lCQJK+cEUzO/v4fYxLPiI/j9uRuOHG9t+u6Xry3xMQfEJNCUfCwJ6LqR1csbf15pT b5wNXZ1BEPC2vgWeC7oPG2Sa8P6vaAmqQkdBXlY1CuXZQUVgFhseKCGHKlx7vt7pIDYv OElciNTDfhUBN2CVCbLqp44QaVeh+7T1xCfbp5G2wXepSR96A+pokF4Q4hrsu+4yRTqd yfYq/lIzVBXSpVEZm0VXW0UoNeNL3dO7CaKKsDN14oI64+UzRzMsbrLJ9zYRAyNWACqE saLg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1773084532; x=1773689332; 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=QPkuWQ+EH6C/B2ZBGIyb4xSDYFIepoBMYztPVZs3kag=; b=Qlh3J1eIZ+sjvk7dU0FYoLgnEpKgZoeHLL2VJlvHrWftQKW4kDWMJCIU/wksYMxWCr z/1gVGtmWkm6mB8U4fnXCujXP0SA5S81zbkf5haYYkW6bhyxbaLUMTXL69NIO4efT4Yh Z9H/Sr9varnXCYeNUPRxeP+pMY9y71hjCvHIJeBAn5QFk37D13gt8/fgBtHraBpwIuju 79XmobL32ENeFh0brn+PZF6ls1GGTBl2eThgj0zw2vCxGqdn+LUv+jPc0altT6WeEt6F lJP6hCualQm7d0Hxx8HBdawYCS5CRPIMoNIDddwf3iv20jddff5F/8SHmu8SZTTZQ+Se GhWA== X-Forwarded-Encrypted: i=1; AJvYcCVGveo3rNhhgd4hZGytyijZ8uoMWBBoJr/tIagVJ2ZcFbChMllL9k6Sz3nEwhkII+s9hfFzZfM4ZcTuShbi@lists.postgresql.org X-Gm-Message-State: AOJu0Yy9/jEfs7GVfBpHfaZG7BzjLXWRqFUzSLG2BWPcaydUiZiH6Iqz EO04OypNCCsIjgyVGubyrFWjb3KFlp+kiUnF40VDpoEssl8AQKLRSiXkK8eNRM8Tb7YK7S3NwKS 7jaXqzUqJsV1Xb7npJ43a9RTydieVroQ= X-Gm-Gg: ATEYQzy5IuyBqa5zmSi5hjktF4WJhEdsPSpt5amA3UqghwJz4z2XKodk9XnMEMHwaIr T45S7lsNhjGuduBIbF5GywbV48bp11HUBGNjkEiaP0mxc/o/5avy0Y6TGtgZudBtI3SpDv82IPt bUZV4gBkN1SIrx6DG9kQ2ozDEsmba6HoJzRwl1p5YfVYsjKvM9QE1GmChQL1vAmNR4ruYomsxsP cGhWck/bet6dTugixCv36qgG5G24wEXrePLiNwIjwMxGmkXNjmLMF03jZTVq23pIGCIWFa6RkGO FDHu1D0tB/9BC7lhqItPbwX/0sg0LBSlO/XsUEDM6ruNaY9CXyYSh26nE2fy7HjzW43yGjdLeuO VdWQUYfHvF6w8BbEP+pmLEMGh X-Received: by 2002:a05:7022:6ba1:b0:11b:9386:a3c8 with SMTP id a92af1059eb24-128c2edac80mr5671746c88.41.1773084531902; Mon, 09 Mar 2026 12:28:51 -0700 (PDT) MIME-Version: 1.0 References: In-Reply-To: From: Corey Huinker Date: Mon, 9 Mar 2026 15:28:40 -0400 X-Gm-Features: AaiRm533f4HAS1xi3st33v_4GatEK22Vk-pHJHtGtRwvQf4vB7M9Jg1azJpiUK8 Message-ID: Subject: Re: Add starelid, attnum to pg_stats and leverage this in pg_dump To: Sami Imseih Cc: Nathan Bossart , pgsql-hackers@lists.postgresql.org Content-Type: multipart/alternative; boundary="000000000000ae4c4b064c9c69ef" List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk --000000000000ae4c4b064c9c69ef Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Mon, Mar 9, 2026 at 2:56=E2=80=AFPM Sami Imseih wr= ote: > >> nathan > > > > > > You're both right. Currently, we fetch extended stats one at a time, > thus there's no _immediate_ need to do so. > > > > But "why wait until there is a crisis" is solid reasoning and for that = I > had already coded up the change. > >I did have one small problem in that Michael Paquier had hoped that we > could get the expr index (-1, -2, etc) on the expressions > > as that was something that we at least briefly thought we'd need for > importing expression statistics. However the existing query > > uses a SELECT unnest(a), unnest(b) pattern in it, and WITH ORDINALITY i= s > not allowed, and the workarounds I found seemed a > > bit tortured. Hence, I decided to leave that out so as not to distract > from the now accepted patch, and with that out of the way > > I'll happily inflict that tortured SQL on y'all. > > Can we add the tableid for now (see 0003) and follow-up with another > thread with the sql changes to pg_dump? > Presently, I don't think we make any changes to pg_dump, unless Nathan feels strongly that we should. If and when the need for oid-based fetching of extended stats becomes necessary, we'll at least have a couple versions where the catalog already had the oids handy. > > I also corrected v2-0001. The docs were still referencing "starlid" > instead of "tableid" > I'll make that change in my forthcoming patch. Just rebasing some things. --000000000000ae4c4b064c9c69ef Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable


On Mon, Mar 9, = 2026 at 2:56=E2=80=AFPM Sami Imseih <samimseih@gmail.com> wrote:
>> nathan
>
>
> You're both right. Currently, we fetch extended stats one at a tim= e, thus there's no _immediate_ need to do so.
>
> But "why wait until there is a crisis" is solid reasoning an= d for that I had already coded up the change.
>I did have one small problem in that Michael Paquier had hoped that we = could get the expr index (-1, -2, etc) on the expressions
> as that was something that we at least briefly thought we'd need f= or importing expression statistics. However the existing query
> uses a SELECT unnest(a), unnest(b) pattern in it, and WITH ORDINALITY = is not allowed, and the workarounds I found seemed a
> bit tortured. Hence, I decided to leave that out so as not to distract= from the now accepted patch, and with that out of the way
> I'll happily inflict that tortured SQL on y'all.

Can we add the tableid=C2=A0 for now (see 0003) and follow-up with another<= br> thread with the sql changes to pg_dump?

Presently, I don't think we make any changes to pg_dump, unless Nathan= feels strongly that we should. If and when the need for oid-based fetching= of extended stats becomes necessary, we'll at least have a couple vers= ions where the catalog already had the oids handy.
=C2= =A0

I also corrected v2-0001. The docs were still referencing "starlid&quo= t;
instead of "tableid"

I'll= make that change in my forthcoming patch. Just rebasing some things.
=


--000000000000ae4c4b064c9c69ef--