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

Commitbf0b6ac

Browse files
committed
Skip opfamily check in eclass_matches_any_index() when the index isn't a
btree. We can't easily tell whether clauses generated from the equivalenceclass could be used with such an index, so just assume that they might be.This bit of over-optimization prevented use of non-btree indexes for nestloopinner indexscans, in any case where the join uses an equality operator thatis also a btree operator --- which in particular is typically true for hashindexes. Noted while trying to test the current hash index patch.
1 parentcdd0895 commitbf0b6ac

File tree

1 file changed

+13
-2
lines changed

1 file changed

+13
-2
lines changed

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

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
*
1010
*
1111
* IDENTIFICATION
12-
* $PostgreSQL: pgsql/src/backend/optimizer/path/indxpath.c,v 1.232 2008/08/14 18:47:59 tgl Exp $
12+
* $PostgreSQL: pgsql/src/backend/optimizer/path/indxpath.c,v 1.233 2008/09/12 14:56:13 tgl Exp $
1313
*
1414
*-------------------------------------------------------------------------
1515
*/
@@ -1584,7 +1584,18 @@ eclass_matches_any_index(EquivalenceClass *ec, EquivalenceMember *em,
15841584
{
15851585
OidcurFamily=families[0];
15861586

1587-
if (list_member_oid(ec->ec_opfamilies,curFamily)&&
1587+
/*
1588+
* If it's a btree index, we can reject it if its opfamily isn't
1589+
* compatible with the EC, since no clause generated from the
1590+
* EC could be used with the index. For non-btree indexes,
1591+
* we can't easily tell whether clauses generated from the EC
1592+
* could be used with the index, so only check for expression
1593+
* match. This might mean we return "true" for a useless index,
1594+
* but that will just cause some wasted planner cycles; it's
1595+
* better than ignoring useful indexes.
1596+
*/
1597+
if ((index->relam!=BTREE_AM_OID||
1598+
list_member_oid(ec->ec_opfamilies,curFamily))&&
15881599
match_index_to_operand((Node*)em->em_expr,indexcol,index))
15891600
return true;
15901601

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp