Thread

  1. Are extended statistics intentionally not propagated to partitions?

    JoongHyuk Shin <sjh910805@gmail.com> — 2026-05-11T05:27:58Z

    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/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