Re: extended stats on partitioned tables

Justin Pryzby <pryzby@telsasoft.com>

From: Justin Pryzby <pryzby@telsasoft.com>
To: Tomas Vondra <tomas.vondra@enterprisedb.com>
Cc: Zhihong Yu <zyu@yugabyte.com>, Jaime Casanova <jcasanov@systemguards.com.ec>, pgsql-hackers@postgresql.org
Date: 2021-12-12T21:49:15Z
Lists: pgsql-hackers
On Sun, Dec 12, 2021 at 10:29:39PM +0100, Tomas Vondra wrote:
> On 12/12/21 18:52, Justin Pryzby wrote:
> That's mostly a conscious choice, so that I don't have to include
> parsetree.h. But maybe that'd be better ...
> 
> > The regression tests changed as a result of not populating stx_data; I think
> > it's may be better to update like this:
> > 
> > SELECT stxname, stxdndistinct, stxddependencies, stxdmcv, stxoid IS NULL
> >   FROM pg_statistic_ext s LEFT JOIN pg_statistic_ext_data d
> >   ON d.stxoid = s.oid
> >   WHERE s.stxname = 'ab1_a_b_stats';
> > 
> 
> Not sure I understand. Why would this be better than inner join?

It shows that there's an entry in pg_statistic_ext and not one in ext_data,
rather than that it's not in at least one of the catalogs.  Which is nice to
show since as you say it's no longer 1:1.

> Thanks, fixed. Can you read through the commit messages and check the
> attribution is correct for all the patches?

Seems fine.

-- 
Justin



Commits

  1. Add stxdinherit flag to pg_statistic_ext_data

  2. Build inherited extended stats on partitioned tables

  3. Ignore extended statistics for inheritance trees

  4. Don't build extended statistics on inheritance trees

  5. Tighten up relation kind checks for extended statistics

  6. Avoid assuming that statistics for a parent relation reflect the properties of