DatabaseManagementSystems3ed,R.RamakrishnanandJ.Gehrke 1
Tree-StructuredIndexes
Chapter9
DatabaseManagementSystems3ed,R.RamakrishnanandJ.Gehrke 2
Introduction
- Asforanyindex,3alternativesfordataentriesk*:
Datarecordwithkeyvalue k
✁<k,ridofdatarecordwithsearchkeyvalue k>
✁<k,listofridsofdatarecordswithsearchkeyk>
- Choiceisorthogonaltotheindexingtechnique
usedtolocatedataentries k*.
- Tree-structuredindexingtechniquessupport
bothrangesearchesandequalitysearches.
- ISAM:staticstructure; B+tree:dynamic,
adjustsgracefullyunderinsertsanddeletes.
DatabaseManagementSystems3ed,R.RamakrishnanandJ.Gehrke 3
RangeSearches
- ``Findallstudentswith gpa >3.0’’
Ifdataisinsortedfile,dobinarysearchtofindfirst suchstudent,thenscantofindothers.
✂Costofbinarysearchcanbequitehigh.
- Simpleidea:Createan`index’file.
* Candobinarysearchon(smaller)indexfile!
Page1 Page2 PageN Page3
DataFile
k2 kN k1
IndexFile