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

Commitc7111d1

Browse files
Revert buggy optimization of index scans
606c012 attempted to reduce cost of index scans using > and <strategies, though got that completely wrong in a few complex cases.Revert whole patch until we find a safe optimization.
1 parent6c90996 commitc7111d1

File tree

3 files changed

+0
-35
lines changed

3 files changed

+0
-35
lines changed

‎src/backend/access/nbtree/nbtsearch.c

Lines changed: 0 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1026,33 +1026,6 @@ _bt_first(IndexScanDesc scan, ScanDirection dir)
10261026
if (goback)
10271027
offnum=OffsetNumberPrev(offnum);
10281028

1029-
/*
1030-
* By here the scan position is now set for the first key. If all further
1031-
* tuples are expected to match we set the SK_BT_MATCHED flag to avoid
1032-
* re-checking the scan key later. This is a big win for slow key matches
1033-
* though is still significant even for fast datatypes.
1034-
*/
1035-
switch (startKeys[0]->sk_strategy)
1036-
{
1037-
caseBTEqualStrategyNumber:
1038-
break;
1039-
1040-
caseBTGreaterEqualStrategyNumber:
1041-
caseBTGreaterStrategyNumber:
1042-
if (ScanDirectionIsForward(dir))
1043-
startKeys[0]->sk_flags |=SK_BT_MATCHED;
1044-
break;
1045-
1046-
caseBTLessEqualStrategyNumber:
1047-
caseBTLessStrategyNumber:
1048-
if (ScanDirectionIsBackward(dir))
1049-
startKeys[0]->sk_flags |=SK_BT_MATCHED;
1050-
break;
1051-
1052-
default:
1053-
break;
1054-
}
1055-
10561029
/* remember which buffer we have pinned, if any */
10571030
Assert(!BTScanPosIsValid(so->currPos));
10581031
so->currPos.buf=buf;

‎src/backend/access/nbtree/nbtutils.c

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1429,13 +1429,6 @@ _bt_checkkeys(IndexScanDesc scan,
14291429
boolisNull;
14301430
Datumtest;
14311431

1432-
/*
1433-
* If the scan key has already matched we can skip this key, as long
1434-
* as the index tuple does not contain NULL values.
1435-
*/
1436-
if (key->sk_flags&SK_BT_MATCHED&& !IndexTupleHasNulls(tuple))
1437-
continue;
1438-
14391432
/* row-comparison keys need special processing */
14401433
if (key->sk_flags&SK_ROW_HEADER)
14411434
{

‎src/include/access/nbtree.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -646,7 +646,6 @@ typedef BTScanOpaqueData *BTScanOpaque;
646646
*/
647647
#defineSK_BT_REQFWD0x00010000/* required to continue forward scan */
648648
#defineSK_BT_REQBKWD0x00020000/* required to continue backward scan */
649-
#defineSK_BT_MATCHED0x00040000/* required to skip further key match */
650649
#defineSK_BT_INDOPTION_SHIFT 24/* must clear the above bits */
651650
#defineSK_BT_DESC(INDOPTION_DESC << SK_BT_INDOPTION_SHIFT)
652651
#defineSK_BT_NULLS_FIRST(INDOPTION_NULLS_FIRST << SK_BT_INDOPTION_SHIFT)

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp