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 21:30:08
Message-ID: CADkLM=f6f+VkpQykYLoD1Jjph_7wvNvKW+2FU8QeKjbSzxsDbA@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

>
>
>
> After a bit of playing around, it seemed messy to make it into
> a join, but we could replace the two array_agg sub-selects with
> a single one:
>
> (SELECT pg_catalog.array_agg(ROW(attname, attstattarget) ORDER BY attnum)
> FROM pg_catalog.pg_attribute WHERE attrelid = i.indexrelid)
>
> and then what we need could be pulled out of that, although
> I'm not sure if pg_dump has logic at hand for deconstructing an
> array of composite.

From what I can see, it doesn't. Moreover, the attstattarget array agg is
only done in version 11 and higher, and we need to go as far back as we've
got expression indexes.

> Or we could leave it as two array_aggs,
> aggregating attname and attstattarget separately but removing
> the attstattarget filter.
>

That's what I was thinking, thanks for the confirmation.

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Andres Freund 2025-02-24 21:33:44 Re: Statistics Import and Export
Previous Message Tom Lane 2025-02-24 21:25:22 Re: Statistics Import and Export