Repeat:
the index-join algorithm
Pseudo code:
while ( R ≠ EOF )
{
read next block of R in buffer b;
for ( each tuple t ∈ b ) do
{
(1) Use t(Y) to lookup in index Y of relation S;
(2a) access all tuples s with s(Y)=t(Y);
(2b) output t ⋈ s
}
}
|
Note:
the index can be
an
ordered index or
a
hash index !!!
The performance of
the index-join algorithm using
a non-clustering index
What is the IO cost to
Compute
R ⋈ S when:
The performance of
the index-join algorithm using
a non-clustering index
What is the IO cost to
Compute
R ⋈ S when:
The join algorithm
will scan the
relation R
once:
IO cost so far:
B(R)
(or:
T(R)
if R is not clustered)
The performance of
the index-join algorithm using
a non-clustering index
What is the IO cost to
Compute
R ⋈ S when:
For
each tuple
t ∈ R,
we read T(S)/V(S,Y) blocks of
relation S
(and
join (⋈)
with tuple t):
(We assume average 1 tuple in a block)
IO cost so far:
B(R)
+
T(R)
×
T(S)/V(S,Y)
The performance of
the index-join algorithm using
a non-clustering index
(The cost to
scan relation R depends
on whether R is
clustered or unclustered)
❮
❯