1
0
mirror of https://github.com/postgres/postgres.git synced 2025-06-30 21:42:05 +03:00

Support hashing for duplicate-elimination in INTERSECT and EXCEPT queries.

This completes my project of improving usage of hashing for duplicate
elimination (aggregate functions with DISTINCT remain undone, but that's
for some other day).

As with the previous patches, this means we can INTERSECT/EXCEPT on datatypes
that can hash but not sort, and it means that INTERSECT/EXCEPT without ORDER
BY are no longer certain to produce sorted output.
This commit is contained in:
Tom Lane
2008-08-07 03:04:04 +00:00
parent 2d1d96b1ce
commit 368df30427
11 changed files with 597 additions and 207 deletions

View File

@ -7,7 +7,7 @@
* Portions Copyright (c) 1994-5, Regents of the University of California
*
* IDENTIFICATION
* $PostgreSQL: pgsql/src/backend/commands/explain.c,v 1.175 2008/05/14 19:10:29 tgl Exp $
* $PostgreSQL: pgsql/src/backend/commands/explain.c,v 1.176 2008/08/07 03:04:03 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@ -558,19 +558,47 @@ explain_outNode(StringInfo str,
pname = "Unique";
break;
case T_SetOp:
switch (((SetOp *) plan)->cmd)
switch (((SetOp *) plan)->strategy)
{
case SETOPCMD_INTERSECT:
pname = "SetOp Intersect";
case SETOP_SORTED:
switch (((SetOp *) plan)->cmd)
{
case SETOPCMD_INTERSECT:
pname = "SetOp Intersect";
break;
case SETOPCMD_INTERSECT_ALL:
pname = "SetOp Intersect All";
break;
case SETOPCMD_EXCEPT:
pname = "SetOp Except";
break;
case SETOPCMD_EXCEPT_ALL:
pname = "SetOp Except All";
break;
default:
pname = "SetOp ???";
break;
}
break;
case SETOPCMD_INTERSECT_ALL:
pname = "SetOp Intersect All";
break;
case SETOPCMD_EXCEPT:
pname = "SetOp Except";
break;
case SETOPCMD_EXCEPT_ALL:
pname = "SetOp Except All";
case SETOP_HASHED:
switch (((SetOp *) plan)->cmd)
{
case SETOPCMD_INTERSECT:
pname = "HashSetOp Intersect";
break;
case SETOPCMD_INTERSECT_ALL:
pname = "HashSetOp Intersect All";
break;
case SETOPCMD_EXCEPT:
pname = "HashSetOp Except";
break;
case SETOPCMD_EXCEPT_ALL:
pname = "HashSetOp Except All";
break;
default:
pname = "HashSetOp ???";
break;
}
break;
default:
pname = "SetOp ???";