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: Jaime Casanova <jcasanov@systemguards.com.ec>, pgsql-hackers@postgresql.org
Date: 2021-11-04T02:20:56Z
Lists: pgsql-hackers
Attachments
On Thu, Nov 04, 2021 at 12:44:45AM +0100, Tomas Vondra wrote: > > I probably did this to make the code change small, to avoid indentin the whole > > block. > > But indenting the block is not necessary. It's possible to do something > like this: > > if (!rel->inh) > return 1.0; > > or whatever is the "default" result for that function. You're right. I did like that, Except in examine_variable, which already does it with "break". > > Maybe the for inh<=1 loop should instead be two calls to new functions factored > > out of get_relation_statistics() and RemoveStatisticsById(), which take "bool > > inh". I did like that in a separate patch for now. And I avoided making a !inh tuple for partitioned tables, since they're never populated. > >> And I'm not sure we do the right thing after removing children, for example > >> (that should drop the inheritance stats, I guess). > > > > Do you mean for inheritance only ? Or partitions too ? > > I think for partitions, the stats should stay. > > And for inheritence, they can stay, for consistency with partitions, and since > > it does no harm. > > > > I think the behavior should be the same as for data in pg_statistic, > i.e. if we keep/remove those, we should do the same thing for extended > statistics. This works for column stats the way I proposed for extended stats: child stats are never removed, neither when the only child is dropped, nor when re-running ANALYZE (actually, that part is odd). I can stop sending patches if it makes it hard to reconcile, but I wanted to put it "on paper" to see/show what the patch series would look like, for v15 and back branches. -- Justin
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