Choosing an algorithm for the
selection (σ) operator
Possible choices of
implementation algorithms for
selection (σ):
Selection criteria:
minimize # disk IO operations
The cost of
the
selection σCond using the
Table-Scan operation
How to process
σC
(for any condition
C) using
a Table-Scan:
(I.e.: we read all tuples and test the selection condition)
The cost of
σC using
Table-Scan:
The cost of
σA=c
using Index-Scan
- clustering index
Case 1:
index on A is
clustering
See:
click here
The cost of
σA=c
using Index-Scan
- non-clustering index
Case 2:
index on A is
non-clustering
See:
click here
The cost of
σA < c
using Index-Scan
- clustering ordered index
Case 1:
index on A is
ordered
and clustering
The cost of
σA=c
using Index-Scan
- non-clustering
ordered index
Case 2:
index on A is
ordered
and non-clustering
Processing an AND-condition in selection
(σA=c AND Cond)
The cost of
processing an AND-condition in selection
(σA=c AND Cond)
Example: picking the
best algorithm for σ
Problem description:
(Click on picture to pull out)
Example: picking the
best algorithm for σ
Choices of
execution plans for
σ
x=1 ∧ y=2 ∧ z<5 (R):
Example: picking the
best algorithm for σ
Cost of
execution plans for
σ
x=1 ∧ y=2 ∧ z<5 (R):
Example: picking the
best algorithm for σ
Cost of
execution plans for
σ
x=1 ∧ y=2 ∧ z<5 (R):
❮
❯