<br />Hi All.<br /><br /> I just looked this email from postgress sql site and wanted to<br /> ask you a question.
Iwould be obliged if you could help me understand <br /> the duplicate key insertion behaviour correctly in Post
gressSQL. <br /><br /> The question is related to Btree [Leman and Yao] implementation<br /> When handling
duplicatekeys<br /><br /> a) Is the key really a duplicate key or TID makes it unique in whole of the index ? <br
/> <br /> a) When inserting data into the BTREE in case of leaf nodes we move <br /> to the right in a random
behaviourandcheck if we need to split or not . <br /> <br /> What does the first movedright mean in
thecode below.<br /><br /> /* Now we are on the right page, so find the insert position. If we <br />
*moved right at all, we know we should insert at the start of the <br /> * page, else must find the
positionby searching. <br /> */ <br /> if (movedright)<br /> <span style="font-weight: bold;">
newitemoff= P_FIRSTDATAKEY(lpageop); </span> <br /> else<br /> newitemoff = _bt_binsrch(rel, buf,
keysz,scankey, false);<br /><br /> b) Once we move right on the leaf , How do we adjust <br /> the parent where
toinsert once we move right on the <br /> child in case of duplicates.. Does the non leaf contain multiple <br
/> duplicate keys as well or is it that the leaf nodes contain multiple <br /> values for the same key . <br
/><br/> Can you please help me understand this, <br /><br />Thanks and appreciate your time.<br /><br />Regards<br
/>Harmeek<br />