Re: Statistics Import and Export

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Corey Huinker <corey(dot)huinker(at)gmail(dot)com>
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:53:56
Message-ID: 1476747.1740430436@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Corey Huinker <corey(dot)huinker(at)gmail(dot)com> writes:
> On Mon, Feb 24, 2025 at 2:36 PM Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:
>> ... 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.

Hmm ... I was thinking we had it already for ALTER INDEX SET
STATISTICS, but I see that is depending on some quite ad-hoc
code (look for indstatcols and indstatvals in pg_dump.c).
I wonder if we could generalize that a bit and share the
work with this case. Those array_agg calls don't look too fast
anyway, would be better if we could rewrite as a join I bet.

regards, tom lane

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Jeff Davis 2025-02-24 21:01:00 Re: Statistics Import and Export
Previous Message Andres Freund 2025-02-24 20:53:04 Re: Statistics Import and Export