Re: Statistics Import and Export - Mailing list pgsql-hackers

From Corey Huinker
Subject Re: Statistics Import and Export
Date
Msg-id CADkLM=dfdTtHcN=oR1sHnUzRfms39MthcBMb7D+Soc=HAWq2ZQ@mail.gmail.com
Whole thread Raw
In response to Re: Statistics Import and Export  (Tom Lane <tgl@sss.pgh.pa.us>)
Responses Re: Statistics Import and Export
List pgsql-hackers
On Mon, Feb 24, 2025 at 2:36 PM Tom Lane <tgl@sss.pgh.pa.us> wrote:
Corey Huinker <corey.huinker@gmail.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, "

 

pgsql-hackers by date:

Previous
From: Tom Lane
Date:
Subject: Re: Statistics Import and Export
Next
From: Jeff Davis
Date:
Subject: Re: Statistics Import and Export