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

From Corey Huinker
Subject Re: Statistics Import and Export
Date
Msg-id CADkLM=e-H5H+pY8iA58ie28PVSRJ1HBpzyy1=FWmy0Hm+s4boQ@mail.gmail.com
Whole thread Raw
In response to Re: Statistics Import and Export  (Nathan Bossart <nathandbossart@gmail.com>)
Responses Re: Statistics Import and Export
Re: Statistics Import and Export
List pgsql-hackers
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).

It's been considered and not ruled out, with a "let's see how the simple thing works, first" approach. Considerations are:

* pg_stats is keyed on schemaname + tablename (which can also be indexes) and we need to use that because of the security barrier
* Joining pg_class and pg_namespace to pg_stats was specifically singled out as a thing to remove.
* The stats data is kinda heavy (most common value lists, most common elements lists, esp for high stattargets), which would be a considerable memory impact and some of those stats might not even be needed (example, index stats for a table that is filtered out)

So it's not impossible, but it's trickier than just, say, tables or indexes.

pgsql-hackers by date:

Previous
From: Nathan Bossart
Date:
Subject: Re: Statistics Import and Export
Next
From: Andres Freund
Date:
Subject: Re: [PATCH] pg_stat_activity: make slow/hanging authentication more visible