Thread: pgsql-server/src backend/optimizer/path/allpat ...

pgsql-server/src backend/optimizer/path/allpat ...

From
tgl@postgresql.org (Tom Lane)
Date:
CVSROOT:    /cvsroot
Module name:    pgsql-server
Changes by:    tgl@postgresql.org    03/02/15 15:12:41

Modified files:
    src/backend/optimizer/path: allpaths.c pathkeys.c
    src/backend/optimizer/plan: planner.c
    src/backend/optimizer/util: pathnode.c relnode.c tlist.c
    src/include/optimizer: pathnode.h paths.h tlist.h

Log message:
    Teach planner how to propagate pathkeys from sub-SELECTs in FROM up to
    the outer query.  (The implementation is a bit klugy, but it would take
    nontrivial restructuring to make it nicer, which this is probably not
    worth.)  This avoids unnecessary sort steps in examples like
    SELECT foo,count(*) FROM (SELECT ... ORDER BY foo,bar) sub GROUP BY foo
    which means there is now a reasonable technique for controlling the
    order of inputs to custom aggregates, even in the grouping case.