Re: extended stats on partitioned tables

From: Justin Pryzby <pryzby(at)telsasoft(dot)com>
To: Jaime Casanova <jcasanov(at)systemguards(dot)com(dot)ec>
Cc: Tomas Vondra <tomas(dot)vondra(at)enterprisedb(dot)com>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: extended stats on partitioned tables
Date: 2021-10-07 22:45:43
Message-ID: 20211007224543.GH27491@telsasoft.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Thu, Oct 07, 2021 at 03:26:46PM -0500, Jaime Casanova wrote:
> On Sun, Sep 26, 2021 at 03:25:50PM -0500, Justin Pryzby wrote:
> > On Sat, Sep 25, 2021 at 05:31:52PM -0500, Justin Pryzby wrote:
> > > It seems like your patch should also check "inh" in examine_variable and
> > > statext_expressions_load.
> >
> > I tried adding that - I mostly kept my patches separate.
> > Hopefully this is more helpful than a complication.
> > I added at: https://commitfest.postgresql.org/35/3332/
> >
>
> Actually, this is confusing. Which patch is the one we should be
> reviewing?

It is confusing, but not as much as I first thought. Please check the commit
messages.

The first two patches are meant to be applied to master *and* backpatched. The
first one intends to fixes the bug that non-inherited stats are being used for
queries of inheritance trees. The 2nd one fixes the regression that stats are
not collected for inheritence trees of partitioned tables (which is the only
type of stats they could ever possibly have).

And the 3rd+4th patches (Tomas' plus my changes) allow collecting both
inherited and non-inherited stats, only in master, since it requires a catalog
change. It's a bit confusing that patch #4 removes most what I added in
patches 1 and 2. But that's exactly what's needed to collect and apply both
inherited and non-inherited stats: the first two patches avoid applying stats
collected with the wrong inheritence. That's also what's needed for the
patchset to follow the normal "apply to master and backpatch" process, rather
than 2 patches which are backpatched but not applied to master, and one which
is applied to master and not backpatched..

@Tomas: I just found commit 427c6b5b9, which is a remarkably similar issue
affecting column stats 15 years ago.

Rebased since there were conflicts with my typos fixes.

--
Justin

Attachment Content-Type Size
v2-0001-Do-not-use-extended-statistics-on-inheritence-tre.patch text/x-diff 6.0 KB
v2-0002-Build-inherited-extended-stats-on-partitioned-tab.patch text/x-diff 6.6 KB
v2-0003-Add-stxdinherit-build-inherited-extended-stats-on.patch text/x-diff 29.2 KB
v2-0004-f-check-inh.patch text/x-diff 8.5 KB
v2-0005-Refactor-parent-ACL-check.patch text/x-diff 6.4 KB

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Matthias van de Meent 2021-10-07 22:46:17 Re: Map WAL segment files on PMEM as WAL buffers
Previous Message Tom Lane 2021-10-07 22:40:37 Re: Time to upgrade buildfarm coverage for some EOL'd OSes?