1
0
mirror of https://github.com/postgres/postgres.git synced 2025-07-28 23:42:10 +03:00

Improve UniquePath logic to detect the case where the input is already

known unique (eg, it is a SELECT DISTINCT ... subquery), and not do a
redundant unique-ification step.
This commit is contained in:
Tom Lane
2004-01-05 18:04:39 +00:00
parent cce442da6d
commit 5c74ce23db
6 changed files with 72 additions and 15 deletions

View File

@ -10,7 +10,7 @@
*
*
* IDENTIFICATION
* $PostgreSQL: pgsql/src/backend/optimizer/plan/createplan.c,v 1.162 2004/01/05 05:07:35 tgl Exp $
* $PostgreSQL: pgsql/src/backend/optimizer/plan/createplan.c,v 1.163 2004/01/05 18:04:38 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@ -605,10 +605,14 @@ create_unique_plan(Query *root, UniquePath *best_path)
subplan->targetlist = newtlist;
}
/* Done if we don't need to do any actual unique-ifying */
if (best_path->umethod == UNIQUE_PATH_NOOP)
return subplan;
/* Copy tlist again to make one we can put sorting labels on */
my_tlist = copyObject(subplan->targetlist);
if (best_path->use_hash)
if (best_path->umethod == UNIQUE_PATH_HASH)
{
long numGroups;