Exercise 2: Selection with Prim.Index
Consider a range query like
select * from R where a between 10 and 30;
|
Give a detailed algorithm for solving such range queries
- assume table is indexed on attribute
a
- assume file is not sorted on
a
- assume existence of
Set data type:
s=empty(); insert(s, n); foreach elems(s)
- assume "the usual" operations on relations:
r = openRelation(name,mode); b=nPages(r); file(r)
- assume "the usual" operations on pages:
buf=getPage(f,pid); foreach tuples(buf); pid = next(buf)
|