Are extended statistics intentionally not propagated to partitions?

Started by JoongHyuk Shin14 days ago1 messageshackers
Jump to latest
#1JoongHyuk Shin
sjh910805@gmail.com

Hi,

On a prior thread about owner assignment between INDEX and STATISTICS
(
/messages/by-id/CACSdjfOyVWALYwb4QrLhAurqo5Ft9XU6zc6SSe=2FoG1DO0WWg@mail.gmail.com
),
the explanation
(/messages/by-id/2119849.1773605379@sss.pgh.pa.us)
was that statistics objects are not always tied to a single table
(and cross-table statistics are a long-term direction). That
answered the owner question, but I noticed a related thing.

CREATE STATISTICS on a partitioned parent does not propagate to
partitions. Unlike CREATE INDEX, which recurses via DefineIndex()
in indexcmds.c, CreateStatistics() in statscmds.c has no recursion;
the object is created only on the parent.

After partition pruning the planner reads stats off the child, which
has no user-defined stats, so operators have to CREATE STATISTICS on
each child manually.

I followed up on the same thread in April, but the patch on that
thread had been withdrawn and the discussion was dormant by then, so
it likely didn't reach a wider audience.

Is the non-propagation intentional or simply not implemented yet?
If "create stats per partition yourself" is the answer, that is
fine. Just confirming.

--
JH Shin