Corey Huinker <corey.huin...@gmail.com> writes: > On Mon, Feb 24, 2025 at 2:36 PM Tom Lane <t...@sss.pgh.pa.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