Query Processing Steps
Query Processing Steps
Query Optimizer
Execution Plan
Result of query
Step 1
The query expressed in high level language must first scanned,
parsed, validated and converted into an intermediate form.
The scanner identifies the language tokens such as sql keywords,
attribute, names, and relation name in the text of the query.
The parser checks the syntax of the query.
The query must also be validated by checking that all the
attribute names and relation names appearing in the query are
valid (name in the database) and so on.
An internal representation of the query is then created query
tree or query graph.
Step 2
The query optimizer generates a variety of execution and
choose the least expensive one.
Execution plan :- Sequence of primitive operations that can be
used to evaluate a query.
Eg:select balance
from account
where balance > 1000
Two plans are:-
1. balance>1000(balance(account))
2. balance(balance>1000(account))
Step 3
The query code generator produces the machine code to
execute the execution plan.
Step 4
The run time database processor executes the query code and
produce the result. If a run time error result, an error message is
generated.