• D
    Order active window clauses for greater reuse of Sort nodes. · 3f0d46f7
    Daniel Gustafsson 提交于
    This is a backport of the below commit from postgres 12dev, which in turn
    is a patch that was influenced by an optimization from the previous version
    of the Greenplum Window code. The idea is to order the Sort nodes based on
    sort prefixes, such that sorts can be reused by subsequent nodes.
    
    As this uses EXPLAIN in the test output, a new expected file is added for
    ORCA output even though the patch only touches the postgres planner.
    
      commit 728202b6
      Author: Andrew Gierth <rhodiumtoad@postgresql.org>
      Date:   Fri Sep 14 17:35:42 2018 +0100
    
        Order active window clauses for greater reuse of Sort nodes.
    
        By sorting the active window list lexicographically by the sort clause
        list but putting longer clauses before shorter prefixes, we generate
        more chances to elide Sort nodes when building the path.
    
        Author: Daniel Gustafsson (with some editorialization by me)
        Reviewed-by: Alexander Kuzmenkov, Masahiko Sawada, Tom Lane
        Discussion: https://postgr.es/m/124A7F69-84CD-435B-BA0E-2695BE21E5C2%40yesql.se
    3f0d46f7
window_optimizer.out 55.1 KB