Skip to content

Commit aca467b

Browse files
committed
Save another little bit of planner overhead on simple queries, by having
clauselist_selectivity skip some analysis that's useless when there's only one clause in the given list. Actually this can win even for not-so-simple queries, because we also apply clauselist_selectivity to sublists such as the quals matching an index; which are likely to have only a single entry even when the total query is quite complicated.
1 parent 7ebbc81 commit aca467b

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

src/backend/optimizer/path/clausesel.c

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
*
99
*
1010
* IDENTIFICATION
11-
* $PostgreSQL: pgsql/src/backend/optimizer/path/clausesel.c,v 1.87 2007/08/31 23:35:22 tgl Exp $
11+
* $PostgreSQL: pgsql/src/backend/optimizer/path/clausesel.c,v 1.88 2007/11/24 19:08:51 tgl Exp $
1212
*
1313
*-------------------------------------------------------------------------
1414
*/
@@ -100,6 +100,14 @@ clauselist_selectivity(PlannerInfo *root,
100100
RangeQueryClause *rqlist = NULL;
101101
ListCell *l;
102102

103+
/*
104+
* If there's exactly one clause, then no use in trying to match up
105+
* pairs, so just go directly to clause_selectivity().
106+
*/
107+
if (list_length(clauses) == 1)
108+
return clause_selectivity(root, (Node *) linitial(clauses),
109+
varRelid, jointype);
110+
103111
/*
104112
* Initial scan over clauses. Anything that doesn't look like a potential
105113
* rangequery clause gets multiplied into s1 and forgotten. Anything that

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy