A small performance bug in BTree Infrastructure - Mailing list pgsql-hackers

From Gokulakannan Somasundaram
Subject A small performance bug in BTree Infrastructure
Date
Msg-id 9362e74e0810230801t41e7df7ax10745c75df88f6cf@mail.gmail.com
Whole thread Raw
List pgsql-hackers
Hi All,<br />       BTree Insert requires a data-structure called BTStack to report the page splits that have happened
inthe leaf pages to non-leaf pages upwards. It basically goes back and updates those non-leaf pages. But this will
neverhappen in a search operation. You never need to climb upwards for a  Select statement. Actually we can clearly see
thatin the _bt_first function, as soon as we complete calling _bt_search, we call _bt_freestack to free it. So
unnecessarilya BTStack structure is getting formed and deleted.<br />        Inside _bt_search function, if we just add
aif 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
performancedifference(as expected).<br />        <br />        Still i thought of reporting it, so that whoever is
workingon it, can incorporate this change also.<br /><br />Thanks,<br />Gokul.<br /> 

pgsql-hackers by date:

Previous
From: Zdenek Kotala
Date:
Subject: Any reason to have heap_(de)formtuple?
Next
From: Peter Eisentraut
Date:
Subject: Re: Unicode escapes in literals