• Robert Haas's avatar
    Don't scan partitioned tables. · d3cc37f1
    Robert Haas authored
    Partitioned tables do not contain any data; only their unpartitioned
    descendents need to be scanned.  However, the partitioned tables still
    need to be locked, even though they're not scanned.  To make that
    work, Append and MergeAppend relations now need to carry a list of
    (unscanned) partitioned relations that must be locked, and InitPlan
    must lock all partitioned result relations.
    
    Aside from the obvious advantage of avoiding some work at execution
    time, this has two other advantages.  First, it may improve the
    planner's decision-making in some cases since the empty relation
    might throw things off.  Second, it paves the way to getting rid of
    the storage for partitioned tables altogether.
    
    Amit Langote, reviewed by me.
    
    Discussion: http://postgr.es/m/6837c359-45c4-8044-34d1-736756335a15@lab.ntt.co.jp
    d3cc37f1
inherit.sql 25.3 KB