Thread: pgsql: Teach the system how to use hashing for UNION.

pgsql: Teach the system how to use hashing for UNION.

From
tgl@postgresql.org (Tom Lane)
Date:
Log Message:
-----------
Teach the system how to use hashing for UNION.  (INTERSECT/EXCEPT will follow,
but seem like a separate patch since most of the remaining work is on the
executor side.)  I took the opportunity to push selection of the grouping
operators for set operations into the parser where it belongs.  Otherwise this
is just a small exercise in making prepunion.c consider both alternatives.

As with the recent DISTINCT patch, this means we can UNION on datatypes that
can hash but not sort, and it means that UNION without ORDER BY is no longer
certain to produce sorted output.

Modified Files:
--------------
    pgsql/src/backend/catalog:
        dependency.c (r1.77 -> r1.78)
        (http://anoncvs.postgresql.org/cvsweb.cgi/pgsql/src/backend/catalog/dependency.c?r1=1.77&r2=1.78)
    pgsql/src/backend/nodes:
        copyfuncs.c (r1.396 -> r1.397)
        (http://anoncvs.postgresql.org/cvsweb.cgi/pgsql/src/backend/nodes/copyfuncs.c?r1=1.396&r2=1.397)
        equalfuncs.c (r1.325 -> r1.326)
        (http://anoncvs.postgresql.org/cvsweb.cgi/pgsql/src/backend/nodes/equalfuncs.c?r1=1.325&r2=1.326)
        outfuncs.c (r1.330 -> r1.331)
        (http://anoncvs.postgresql.org/cvsweb.cgi/pgsql/src/backend/nodes/outfuncs.c?r1=1.330&r2=1.331)
        readfuncs.c (r1.211 -> r1.212)
        (http://anoncvs.postgresql.org/cvsweb.cgi/pgsql/src/backend/nodes/readfuncs.c?r1=1.211&r2=1.212)
    pgsql/src/backend/optimizer/plan:
        planner.c (r1.239 -> r1.240)
        (http://anoncvs.postgresql.org/cvsweb.cgi/pgsql/src/backend/optimizer/plan/planner.c?r1=1.239&r2=1.240)
    pgsql/src/backend/optimizer/prep:
        prepunion.c (r1.149 -> r1.150)
        (http://anoncvs.postgresql.org/cvsweb.cgi/pgsql/src/backend/optimizer/prep/prepunion.c?r1=1.149&r2=1.150)
    pgsql/src/backend/optimizer/util:
        clauses.c (r1.260 -> r1.261)
        (http://anoncvs.postgresql.org/cvsweb.cgi/pgsql/src/backend/optimizer/util/clauses.c?r1=1.260&r2=1.261)
        pathnode.c (r1.144 -> r1.145)
        (http://anoncvs.postgresql.org/cvsweb.cgi/pgsql/src/backend/optimizer/util/pathnode.c?r1=1.144&r2=1.145)
        tlist.c (r1.79 -> r1.80)
        (http://anoncvs.postgresql.org/cvsweb.cgi/pgsql/src/backend/optimizer/util/tlist.c?r1=1.79&r2=1.80)
    pgsql/src/backend/parser:
        analyze.c (r1.375 -> r1.376)
        (http://anoncvs.postgresql.org/cvsweb.cgi/pgsql/src/backend/parser/analyze.c?r1=1.375&r2=1.376)
        parse_clause.c (r1.174 -> r1.175)
        (http://anoncvs.postgresql.org/cvsweb.cgi/pgsql/src/backend/parser/parse_clause.c?r1=1.174&r2=1.175)
    pgsql/src/include/catalog:
        catversion.h (r1.475 -> r1.476)
        (http://anoncvs.postgresql.org/cvsweb.cgi/pgsql/src/include/catalog/catversion.h?r1=1.475&r2=1.476)
    pgsql/src/include/nodes:
        parsenodes.h (r1.370 -> r1.371)
        (http://anoncvs.postgresql.org/cvsweb.cgi/pgsql/src/include/nodes/parsenodes.h?r1=1.370&r2=1.371)
    pgsql/src/include/optimizer:
        tlist.h (r1.50 -> r1.51)
        (http://anoncvs.postgresql.org/cvsweb.cgi/pgsql/src/include/optimizer/tlist.h?r1=1.50&r2=1.51)
    pgsql/src/include/parser:
        parse_clause.h (r1.51 -> r1.52)
        (http://anoncvs.postgresql.org/cvsweb.cgi/pgsql/src/include/parser/parse_clause.h?r1=1.51&r2=1.52)
    pgsql/src/test/regress/expected:
        copyselect.out (r1.1 -> r1.2)
        (http://anoncvs.postgresql.org/cvsweb.cgi/pgsql/src/test/regress/expected/copyselect.out?r1=1.1&r2=1.2)
        union.out (r1.11 -> r1.12)
        (http://anoncvs.postgresql.org/cvsweb.cgi/pgsql/src/test/regress/expected/union.out?r1=1.11&r2=1.12)
    pgsql/src/test/regress/sql:
        copyselect.sql (r1.1 -> r1.2)
        (http://anoncvs.postgresql.org/cvsweb.cgi/pgsql/src/test/regress/sql/copyselect.sql?r1=1.1&r2=1.2)
        union.sql (r1.6 -> r1.7)
        (http://anoncvs.postgresql.org/cvsweb.cgi/pgsql/src/test/regress/sql/union.sql?r1=1.6&r2=1.7)