Hi All,
       BTree Insert requires a data-structure called BTStack to report the
page splits that have happened in the leaf pages to non-leaf pages upwards.
It basically goes back and updates those non-leaf pages. But this will never
happen in a search operation. You never need to climb upwards for a  Select
statement. Actually we can clearly see that in the _bt_first function, as
soon as we complete calling _bt_search, we call _bt_freestack to free it. So
unnecessarily a BTStack structure is getting formed and deleted.
       Inside _bt_search function, if we just add a if condition to check
whether access is for BT_READ, then we can avoid the creation of stack and
also remove the _bt_freestack  in the _bt_first function. I just implemented
the change and tested it and i am not seeing any performance difference(as
expected).

        Still i thought of reporting it, so that whoever is working on it,
can incorporate this change also.

Thanks,
Gokul.

Reply via email to