Re: pg_stats and range statistics

From: Tomas Vondra <tomas(dot)vondra(at)enterprisedb(dot)com>
To: Egor Rogov <e(dot)rogov(at)postgrespro(dot)ru>, Soumyadeep Chakraborty <soumyadeep2007(at)gmail(dot)com>
Cc: PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: pg_stats and range statistics
Date: 2023-01-20 21:50:56
Message-ID: cca33c94-f3ea-3200-9195-ac923485d498@enterprisedb.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi Egor,

While reviewing a patch improving join estimates for ranges [1] I
realized we don't show stats for ranges in pg_stats, and I recalled we
had this patch.

I rebased the v2, and I decided to took a stab at showing separate
histograms for lower/upper histogram bounds. I believe it makes it way
more readable, which is what pg_stats is about IMHO.

This simply adds two functions, accepting/producing anyarray - one for
lower bounds, one for upper bounds. I don't think it can be done with a
plain subquery (or at least I don't know how).

Finally, it renames the empty_range_frac to start with range_, per the
earlier discussion. I wonder if the new column names for lower/upper
bounds (range_lower_bounds_histograms/range_upper_bounds_histograms) are
too long ...

regards

[1] https://commitfest.postgresql.org/41/3821/

--
Tomas Vondra
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company

Attachment Content-Type Size
0001-Display-length-and-bounds-histograms-in-pg_-20230120.patch text/x-patch 6.2 KB
0002-add-functions-to-extract-lower-upper-ramge--20230120.patch text/x-patch 6.4 KB
0003-rename-empty_range_frac-20230120.patch text/x-patch 965 bytes

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Merlin Moncure 2023-01-20 22:24:31 feature request: IN clause optimized through append nodes with UNION ALL
Previous Message Robert Haas 2023-01-20 21:37:19 Re: almost-super-user problems that we haven't fixed yet