Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit9587170

Browse files
committed
Adjust OR indexscan logic to not generate redundant condition-free OR
indexscans involving partial indexes. These would always be dominatedby a simple indexscan on such an index, so there's no point in consideringthem. Fixes overoptimism in a patch I applied last October.
1 parent295dd33 commit9587170

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

‎src/backend/optimizer/path/orindxpath.c

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
*
99
*
1010
* IDENTIFICATION
11-
* $PostgreSQL: pgsql/src/backend/optimizer/path/orindxpath.c,v 1.64 2004/12/31 22:00:04 pgsql Exp $
11+
* $PostgreSQL: pgsql/src/backend/optimizer/path/orindxpath.c,v 1.65 2005/03/01 01:40:05 tgl Exp $
1212
*
1313
*-------------------------------------------------------------------------
1414
*/
@@ -387,10 +387,14 @@ best_or_subclause_index(Query *root,
387387

388388
/*
389389
* Ignore index if it doesn't match the subclause at all; except
390-
* that if it's a partial index, consider it anyway, since the
391-
* selectivity of the predicate alone might make the index useful.
390+
* that if it's a partial index matching the current OR subclause,
391+
* consider it anyway, since effectively we are using the index
392+
* predicate to match the subclause. (Note: we exclude partial
393+
* indexes that are predOK; else such a partial index would be
394+
* considered to match *every* OR subclause, generating bogus OR
395+
* plans that are redundant with the basic scan on that index.)
392396
*/
393-
if (indexclauses==NIL&&index->indpred==NIL)
397+
if (indexclauses==NIL&&(index->indpred==NIL||index->predOK))
394398
continue;
395399

396400
/* Convert clauses to indexquals the executor can handle */

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp