-
Type: Task
-
Resolution: Won't Fix
-
Priority: Major - P3
-
None
-
Affects Version/s: None
-
Component/s: None
-
Storage Engines
-
8
-
Storage Engines - 2022-10-03, Storage Engines - 2022-10-17, Storage Engines - 2022-10-31, 2024-02-20_A_near-death_puffin
Search_near guarantees that it will return a record either side of the search key if one is visible, to do this it performs an initial cursor_row/col_search followed by a cursor->next loop, and if nothing is found then a cursor->prev loop. This isn't that efficient as the cursor->prev loop starts it's walk at the beginning of the tree instead of where the original call to cursor_row/col_search placed the cursor.
This behaviour is required for lower isolation levels such as read_committed however for snapshot isolation we can guarantee that if no records were seen in the cursor->next walk there won't be any for the same range in the cursor->prev walk. This present an opportunity for optimization and would benefit both regular cursor->search_nears and bounded cursor search_nears.