Re: extended stats on partitioned tables
Tomas Vondra <tomas.vondra@enterprisedb.com>
From: Tomas Vondra <tomas.vondra@enterprisedb.com>
To: Justin Pryzby <pryzby@telsasoft.com>
Cc: Zhihong Yu <zyu@yugabyte.com>,
Jaime Casanova <jcasanov@systemguards.com.ec>, pgsql-hackers@postgresql.org
Date: 2021-12-12T21:29:39Z
Lists: pgsql-hackers
Attachments
- 0004-Refactor-parent-ACL-check-20211212b.patch (text/x-patch) patch 0004
- 0003-Add-stxdinherit-flag-to-pg_statistic_ext_d-20211212b.patch (text/x-patch) patch 0003
- 0002-Build-inherited-extended-stats-on-partitio-20211212b.patch (text/x-patch) patch 0002
- 0001-Ignore-extended-statistics-for-inheritance-20211212b.patch (text/x-patch) patch 0001
On 12/12/21 18:52, Justin Pryzby wrote: > + * XXX Can't we simply look at rte->inh? > + */ > + inh = root->append_rel_array == NULL ? false : > + root->append_rel_array[onerel->relid]->parent_relid != 0; > > I think so. That's what I came up with while trying to figured this out, and > it's no great surprise that it needed to be cleaned up - thanks. > OK, fixed. > In your 0003 patch, the "if inh: break" isn't removed from examine_variable(), > but the corresponding thing is removed everywhere else. > Ah, you're right. And it wasn't updated in the 0002 patch either - it should do the relkind check too, to allow partitioned tables. Fixed. > In 0003, mcv_clauselist_selectivity still uses simple_rte_array rather than > rt_fetch. > 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? > There's this part about documentation for the changes in backbranches: > > On Sun, Sep 26, 2021 at 03:25:50PM -0500, Justin Pryzby wrote: >> Also, I think in backbranches we should document what's being stored in >> pg_statistic_ext, since it's pretty unintuitive: >> - noninherted stats (FROM ONLY) for inheritence parents; >> - inherted stats (FROM *) for partitioned tables; > > spellcheck: inheritence should be inheritance. > Thanks, fixed. Can you read through the commit messages and check the attribution is correct for all the patches? > All for now. I'm going to update the regression tests for dependencies and the > other code paths. > Thanks! -- Tomas Vondra EnterpriseDB: http://www.enterprisedb.com The Enterprise PostgreSQL Company
Commits
-
Add stxdinherit flag to pg_statistic_ext_data
- 269b532aef55 15.0 landed
-
Build inherited extended stats on partitioned tables
- d6817032d26b 13.6 landed
- 20b9fa308ebf 15.0 landed
- ea212bd95fd2 14.2 landed
- 9d1bcf5dc11a 12.10 landed
- 491182e52909 11.15 landed
- 9211c2e38f09 10.20 landed
-
Ignore extended statistics for inheritance trees
- 76569ad6f423 12.10 landed
- ff0e7c7e8401 10.20 landed
- b3cac25f4d50 11.15 landed
- acfde7c5837d 13.6 landed
- 2cc007fd0359 14.2 landed
- 36c4bc6e725f 15.0 landed
-
Don't build extended statistics on inheritance trees
- 859b3003de87 10.10 cited
-
Tighten up relation kind checks for extended statistics
- 8c5cdb7f4f6e 10.0 cited
-
Avoid assuming that statistics for a parent relation reflect the properties of
- 427c6b5b9849 8.2.0 cited