[prev] 39 [next]

N-d Queries and Indexes (cont)

Implementing selection using one of several indices:

// Query: select * from R where a1op1C1 and ... and anopnCn
// choose ai with best selectivity
TupleIDs = IndexLookup(R,ai,opi,Ci)
// gives { tid1, tid2, ...} for tuples satisfying aiopiCi
PageIDs = { }
foreach tid in TupleIDs
   { PageIDs = PageIDs ∪ {pageOf(tid)} }

// PageIDs = a set of bqix page numbers
...

Cost = Costindex + bqix    (some pages do not contain answers, bqix > bq)

DBMSs typically maintain statistics to assist with determining selectivity