0% found this document useful (0 votes)
5 views9 pages

Introduction to query Processing

Query processing involves translating high-level queries into low-level expressions for data retrieval from databases, encompassing steps like parsing, optimization, and evaluation. Parsing checks syntax and semantics, while optimization selects the most efficient execution plan. Best practices for SQL query optimization include using indexes, avoiding unnecessary queries, and optimizing JOIN operations.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
5 views9 pages

Introduction to query Processing

Query processing involves translating high-level queries into low-level expressions for data retrieval from databases, encompassing steps like parsing, optimization, and evaluation. Parsing checks syntax and semantics, while optimization selects the most efficient execution plan. Best practices for SQL query optimization include using indexes, avoiding unnecessary queries, and optimizing JOIN operations.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 9

Introduction to query

Processing
Basics of Query Processing
1.Query Processing includes translations of high-level Queries into low-level expressions
that can be used at the physical level of the file system,
2.High-level queries are converted into low-level expressions during query processing.
3.It 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:
1.Parsing and translation
2.Optimization

3.Evaluation
Basic of Query Processing
Detailed Query Processing
1.Parsing
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
1.Semantic check - syntax check and also spelling check
Eg select * form employee

Shared Pool check

2.Optimization: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.

3.Avoid Queries inside a Loop

4. Use Select instead of Select *

5.Use Exist() instead of Count()

6.Keep Wild cards at the End of Phrases

7. Add Explain to the Beginning of Queries(comments)


8.Avoid Cartesian Products

9.Consider Denormalization
10. Optimize JOIN Operations

You might also like