Cost Estimation
Without executing a plan, cannot always know its precise cost.
Thus, query optimisers estimate costs via:
- cost of performing operation
(dealt with in earlier lectures)
- size of result
(which affects cost of performing next operation)
Result size estimated by statistical measures on relations, e.g.
rS |
cardinality of relation S |
RS |
avg size of tuple in relation S |
V(A,S) |
# distinct values of attribute A |
min(A,S) |
min value of attribute A |
max(A,S) |
max value of attribute A |
|