mirror of
https://github.com/postgres/postgres.git
synced 2025-11-06 07:49:08 +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:
@@ -8,7 +8,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $PostgreSQL: pgsql/src/backend/optimizer/util/clauses.c,v 1.159 2004/01/04 03:51:52 tgl Exp $
|
||||
* $PostgreSQL: pgsql/src/backend/optimizer/util/clauses.c,v 1.160 2004/01/05 18:04:39 tgl Exp $
|
||||
*
|
||||
* HISTORY
|
||||
* AUTHOR DATE MAJOR EVENT
|
||||
@@ -921,6 +921,21 @@ has_distinct_on_clause(Query *query)
|
||||
return false;
|
||||
}
|
||||
|
||||
/*
|
||||
* Test whether a query uses simple DISTINCT, ie, has a distinct-list that
|
||||
* is the same as the set of output columns.
|
||||
*/
|
||||
bool
|
||||
has_distinct_clause(Query *query)
|
||||
{
|
||||
/* Is there a DISTINCT clause at all? */
|
||||
if (query->distinctClause == NIL)
|
||||
return false;
|
||||
|
||||
/* It's DISTINCT if it's not DISTINCT ON */
|
||||
return !has_distinct_on_clause(query);
|
||||
}
|
||||
|
||||
|
||||
/*****************************************************************************
|
||||
* *
|
||||
|
||||
Reference in New Issue
Block a user