5: Query Processing/ Optimisation Flashcards
What is query processing?
It’s the steps required to execute a query.
What costs does processing incur?
- I/O costs for accessing the data
- Communications costs for transmitting data over any distance
- CPU costs for processing the data
Summary: accessing, transmitting and processing costs
What is query optimisation?
It’s one of the steps in query processing which is used to identify the ‘best’ execution strategy ie the one with the minimum resources and therefore costs required to execute the query.
What are the 3 different levels in a tree structure?
- Leaf node level -> relations
- Non-leaf node level -> RA operations
- Root-node level -> result
What is the heuristic approach?
Its then transformation rules convert algebraic expressions into alternative forms (several trees).
Each tree has its own unique execution sequence, with unique costs for that sequence.
Heuristic approach provides alternative forms that are more efficient, eg perform a select before performing a join.
The initial tree is based on the Cartesian Product of the relations. Would you use this tree?
No.
The Cartesian Product produces all possible combinations of any join – resulting in very large relations.
The query optimiser produces several execution sequences. Does it then look for the ‘absolute best’ one?
No, this would add to the cost.
Optimisation is about selecting from the alternatives an execution sequence that is considered efficient enough to run the query, even though there may be other more efficient ones available.
How do you read the relational algebra tree?
Bottom-up ^
Start at leaf-nodes and traverse up the root.