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:
@ -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)
|
||||
{
|
||||
|
Reference in New Issue
Block a user