Re: Statistics Import and Export

From: Corey Huinker <corey(dot)huinker(at)gmail(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Jeff Davis <pgsql(at)j-davis(dot)com>, Andres Freund <andres(at)anarazel(dot)de>, Michael Paquier <michael(at)paquier(dot)xyz>, jian he <jian(dot)universality(at)gmail(dot)com>, Nathan Bossart <nathandbossart(at)gmail(dot)com>, Bruce Momjian <bruce(at)momjian(dot)us>, Matthias van de Meent <boekewurm+postgres(at)gmail(dot)com>, Magnus Hagander <magnus(at)hagander(dot)net>, Stephen Frost <sfrost(at)snowman(dot)net>, Ashutosh Bapat <ashutosh(dot)bapat(dot)oss(at)gmail(dot)com>, Peter Smith <smithpb2250(at)gmail(dot)com>, PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>, alvherre(at)alvh(dot)no-ip(dot)org
Subject: Re: Statistics Import and Export
Date: 2025-02-24 20:40:53
Message-ID: CADkLM=dfdTtHcN=oR1sHnUzRfms39MthcBMb7D+Soc=HAWq2ZQ@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Mon, Feb 24, 2025 at 2:36 PM Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:

> Corey Huinker <corey(dot)huinker(at)gmail(dot)com> writes:
> > Sadly, that attnum isn't available in pg_stats, so we'd have to
> reintroduce
> > the joins to pg_namespace and pg_class to get at pg_attribute, at least
> for
> > indexes.
>
> This argument seems to be made still from the mindset that you are
> going to form a query that produces exactly what needs to be dumped,
> without any additional processing. pg_dump has all that info at
> hand; there is no need to re-query the server for it.

I went looking just now, and I can't find it. I see where we have attname
and attnum arrays for tables, but not indexes. We keep an array of attnums
for the index, but we'd need to add an array of attnames in order to
correlate back to our results of pg_stats. If I'm missing something, please
correct me, but it seems like all the index stuff we'd get from attributes
we instead get from:

"pg_catalog.pg_get_indexdef(i.indexrelid) AS indexdef, "

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Jeff Davis 2025-02-24 20:41:21 Re: Statistics Import and Export
Previous Message Tom Lane 2025-02-24 20:40:13 Re: Statistics Import and Export