On Wed, Mar 05, 2025 at 08:17:53PM -0500, Andres Freund wrote:
> Right now --statistics more than doubles the number of queries that pg_dump
> issues. That's oviously noticeable locally, but it's going to be really
> noticeable when dumping across the network.
>
> I think we need to do more to lessen the impact. Even leaving regression test
> performance aside, the time increase for the default pg_dump invocation will
> be painful for folks, particularly due to this being enabled by default.
>
> One fairly easy win would be to stop issuing getAttributeStats() for
> non-expression indexes. In most cases that'll already drastically cut down on
> the extra queries.
Apologies if this has already been considered upthread, but would it be
possible to use one query to gather all the required information into a
sorted table? At a glance, it looks to me like it might be feasible. I
had a lot of luck with reducing the number per-object queries with that
approach recently (e.g., commit 2329cad).
--
nathan