1
0
mirror of https://github.com/postgres/postgres.git synced 2025-07-28 23:42:10 +03:00

Reduce btree scan overhead for < and > strategies

For <, <=, > and >= strategies, mark the first scan key
as already matched if scanning in an appropriate direction.
If index tuple contains no nulls we can skip the first
re-check for each tuple.

Author: Rajeev Rastogi
Reviewer: Haribabu Kommi
Rework of the code and comments by Simon Riggs
This commit is contained in:
Simon Riggs
2014-11-18 10:24:55 +00:00
parent dedae6c211
commit 606c0123d6
3 changed files with 35 additions and 0 deletions

View File

@ -1429,6 +1429,13 @@ _bt_checkkeys(IndexScanDesc scan,
bool isNull;
Datum test;
/*
* If the scan key has already matched we can skip this key, as
* long as the index tuple does not contain NULL values.
*/
if (key->sk_flags & SK_BT_MATCHED && !IndexTupleHasNulls(tuple))
continue;
/* row-comparison keys need special processing */
if (key->sk_flags & SK_ROW_HEADER)
{