• Tom Lane's avatar
    Improve cost estimation for aggregates and window functions. · e6a30a8c
    Tom Lane authored
    The previous coding failed to account properly for the costs of evaluating
    the input expressions of aggregates and window functions, as seen in a
    recent gripe from Claudio Freire.  (I said at the time that it wasn't
    counting these costs at all; but on closer inspection, it was effectively
    charging these costs once per output tuple.  That is completely wrong for
    aggregates, and not exactly right for window functions either.)
    
    There was also a hard-wired assumption that aggregates and window functions
    had procost 1.0, which is now fixed to respect the actual cataloged costs.
    
    The costing of WindowAgg is still pretty bogus, since it doesn't try to
    estimate the effects of spilling data to disk, but that seems like a
    separate issue.
    e6a30a8c
clauses.h 2.86 KB