Introduction to query
Processing
Basics of Query Processing
[Link] Processing includes translations of high-level Queries into low-level expressions
that can be used at the physical level of the file system,
[Link]-level queries are converted into low-level expressions during query processing.
[Link] is a methodical procedure that can be applied at the physical level of the file system
Definition -The process of extracting data from a database is called query processing. It
requires several steps to retrieve the data from the database during query processing. The
actions involved actions are:
[Link] and translation
[Link]
[Link]
Basic of Query Processing
Detailed Query Processing
[Link]
During the parse call, the database performs the following checks: Syntax check,
Semantic check, and Shared pool check, after converting the query into relational
algebra because certain activities for data retrieval are included in query processing.
Steps in Parsing
[Link] check - syntax check and also spelling check
Eg select * form employee
Shared Pool check
[Link]:the database must perform a hard parse at least for one unique DML
statement and perform optimization during this parse. This database never optimizes
DDL unless it includes a DML component such as a subquery that requires
optimization. The database catalog stores the execution plans and then the optimizer
passes the lowest-cost plan for execution.
Step-3 Evaluation
Finally runs the query and displays the required result.
SQL Query Optimization
1. Use Indexes
2. Use WHERE Clause instead of having :WHERE query execute more quickly than HAVING.
WHERE filters are recorded before groups are created and HAVING filters are recorded after the
creation of groups.
[Link] Queries inside a Loop
4. Use Select instead of Select *
[Link] Exist() instead of Count()
[Link] Wild cards at the End of Phrases
7. Add Explain to the Beginning of Queries(comments)
[Link] Cartesian Products
[Link] Denormalization
10. Optimize JOIN Operations