Hi,

On a prior thread about owner assignment between INDEX and STATISTICS
(
https://www.postgresql.org/message-id/CACSdjfOyVWALYwb4QrLhAurqo5Ft9XU6zc6SSe%3D2FoG1DO0WWg%40mail.gmail.com
),
the explanation
(https://www.postgresql.org/message-id/[email protected])
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

Reply via email to