0% found this document useful (0 votes)
14 views4 pages

Steps in Query Processing Overview

Query processing involves extracting data from a database through three main steps: parsing and translation, optimization, and evaluation. The process begins with translating high-level queries into a form suitable for execution, followed by selecting the most efficient evaluation plan based on cost estimation. Finally, the chosen plan is executed to return the query results.
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)
14 views4 pages

Steps in Query Processing Overview

Query processing involves extracting data from a database through three main steps: parsing and translation, optimization, and evaluation. The process begins with translating high-level queries into a form suitable for execution, followed by selecting the most efficient evaluation plan based on cost estimation. Finally, the chosen plan is executed to return the query results.
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

Database Management System: Unit IV: Implementation Techniques

Query Processing Overview


Implementation Techniques - Database Management System

Home | All Subjects | CSE Department | Database Management System


<< Previous Next >>

Query processing is a collection of activities that are involved in extracting data from database.

Part II: Query Processing


Query Processing Overview
AU: May-14,16,18, Dec.-19, Marks 16
• Query processing is a collection of activities that are involved in extracting data from
database.
• During query processing there is translation high level database language queries into the
expressions that can be used at the physical level of filesystem.
• There are three basic steps involved in query processing and those are -
1. Parsing and Translation
• In this step the query is translated into its internal form and then into relational algebra.
• Parser checks syntax and verifies relations.
• For instance - If we submit the query as,
SELECT RollNo, name
FROM Student
HAVING RollNo=10
Then it will issue a syntactical error message as the correct query should be
SELECT RollNo, name
FROM Student
HAVING RollNo=10
Thus during this step the syntax of the query is checked so that only correct and verified
query can be submitted for further processing.
2. Optimization
• During this process thequery evaluation plan is prepared from all the relational algebraic
expressions. bud off
• The query cost for all the evaluation plans is calculated.
• Amongst all equivalent evaluation plans the one with lowest cost is chosen.
• Cost is estimated using statistical information from the database catalog, such asthe
number of tuples in each relation, size of tuples, etc.
3. Evaluation
• The query-execution engine takes a query-evaluation plan, executes that plan, and returns
the answers to the query.
For example - If the SQL query is,
SELECT balance
FROM account
WHERE balance<1000
Step 1: This query is first verified by the parser and translator unit for correct syntax. If so
then the relational algebra expressions can be obtained. For the above given queries there
are two possible relational algebra
(1) σbalance<1000(Πbalance (account))
(2) Πbalance ( σbalance<1000 (account))
Step 2: Query Evaluation Plan: To specify fully how to evaluate a query, we need not only
to provide the relational-algebra expression, but also to annotate it with instructions
specifying how to evaluate each operation. For that purpose, using the order of evaluation
of queries, two query evaluation plans are prepared. These are as follows

Associated with each query evaluation plan there is a query cost. The query optimization
selects the query evaluation plan having minimum query cost.
Once the query plan is chosen, the query is evaluated with that plan and the result of the
query is output.

Review Questions
1. Briefly explain about query processing. AU: May-14, 16, Marks 16
2. What is query optimization? Outline the steps in query optimization. AU: May-18,
Marks 13
3. Sketch and concise the basic steps in query processing. AU: Dec-19, Marks 3

Database Management System: Unit IV: Implementation Techniques : Tag: : Implementation


Techniques - Database Management System - Query Processing Overview

Home | All Subjects | CSE Department | UNIT: Database Management System


<< Previous Next >>

Related Topics

RAID - Implementation Techniques - Database Management System

File Organization - Implementation Techniques - Database Management System

Organization of Records in Files - Implementation Techniques - Database Management System

Data Dictionary Storage - Implementation Techniques - Database Management System

Column Oriented Storage - Implementation Techniques - Database Management System

Indexing and Hashing - Implementation Techniques - Database Management System

Ordered Indices - Implementation Techniques - Database Management System

B+ Tree Index Files - Implementation Techniques - Database Management System

B Tree Index Files - Implementation Techniques - Database Management System

Concept of Hashing - Implementation Techniques - Database Management System

Static Hashing - Implementation Techniques - Database Management System

Dynamic Hashing - Implementation Techniques - Database Management System

Query Processing Overview - Implementation Techniques - Database Management System

Measure of Query Cost - Implementation Techniques - Database Management System

Algorithms for Selection,Sorting and Join Operations - Implementation Techniques -


Database Management System

Related Subjects

Database Management System

CS3492 4th Semester CSE Dept | 2021


Regulation | 4th Semester CSE Dept 2021
Regulation
We provide Notes, Study material pdf download, lecture notes, important questions and answers, University question paper pdf download, Question bank for
Engineering students in Tamilnadu under Anna University Affiliated colleges. EEE, ECE, MECH, CIVIL, CSE, IT are the major departments covered by our website.
[2021 Regulation, All 8 semester, All 4 years ]

About | Contact Us | Privacy Policy | Terms and Conditions | Disclaimer | DMCA Complaint | Upload Content | Send Content

© 2022 - 2023 Copyright: [Link]

Common questions

Powered by AI

The selection of a query evaluation plan substantially impacts the efficiency of a database management system as it determines how data is accessed and processed. A well-selected plan minimizes the use of system resources by choosing the most efficient order of operations, appropriate indices, and join methods, leading to faster execution and reduced CPU and I/O usage. Conversely, a suboptimal plan may result in high latency and increased resource consumption, affecting overall system performance. This selection is informed by cost estimates derived from statistical analyses, ensuring optimal resource utilization and response times for user queries .

Parsing in the initial step of query processing is crucial beyond syntax checking as it involves converting the high-level query into an internal, executable form using relational algebra. This step not only ensures the query is syntactically correct but also prepares it for optimization by breaking it down into logical operations that the database engine understands. Successful parsing sets the stage for effective optimization and evaluation, directly impacting the efficiency and correctness of query execution . This preparation is foundational for subsequent steps, allowing for accurate cost estimation and execution planning .

Relational algebra serves as a formal and intermediate form between SQL queries and their execution, providing a structured framework to express complex SQL operations in terms of basic set-theoretic operations. During query processing, SQL queries are translated into relational algebra expressions to decouple the high-level queries from the physical database implementation. This abstraction allows various optimization strategies to be applied systematically before they are converted to specific, efficient execution plans by the query engine. It acts as a critical step in ensuring the database system can perform complex computations effectively .

Relational algebraic expressions are derived from SQL queries during the parsing and translation phase of query processing. These expressions form the logical basis for creating query evaluation plans. For example, an SQL query 'SELECT balance FROM account WHERE balance<1000' can be translated into relational algebra expressions such as σ (Π (account)) or Π ( σ (account)), which abstractly describe the filtering and projection operations needed . These expressions are then annotated with specific instructions to form query evaluation plans, allowing for efficient execution by the query-execution engine .

The evaluation plan for a query impacts the database system's performance significantly by determining the resource usage and speed of execution. A poor evaluation plan may lead to excessive resource consumption and longer query execution times, whereas an optimized plan can minimize these costs. The choice of plan depends on factors like the selected join methods or indices, order of operations, and the balance between I/O and computation . An optimal plan leverages these factors using statistical information to ensure efficient query processing and system performance .

The measure of query cost plays a crucial role in selecting an optimal query evaluation plan as it quantifies the expected resource usage, such as CPU time and disk I/O, of executing the plan. By estimating the query cost of various evaluation plans, the optimizer can choose the plan with the lowest cost, ensuring that the query executes with minimal resource consumption and in the shortest time possible . This process maximizes database efficiency and performance based on the statistical data gathered from the database catalog about the underlying data structures .

Static hashing uses a fixed number of buckets and a fixed hash function, which can lead to inefficiencies and increased collision handling when the data volume grows significantly beyond the anticipated size. In contrast, dynamic hashing adapts to the data size by increasing or decreasing the number of buckets as needed, which helps maintain efficient lookup times. Static hashing can lead to problems with bucket overflow and underutilized space, affecting query performance in terms of speed and resource cost, while dynamic hashing optimizes storage and access time, allowing for more efficient query processing .

During the parsing step of query processing, syntactical errors in SQL queries might include misuse of clauses or incorrect command structures. For instance, using 'HAVING' instead of 'WHERE' for filtering rows in a query 'SELECT RollNo, name FROM Student HAVING RollNo=10' is incorrect, and it should actually be 'SELECT RollNo, name FROM Student WHERE RollNo=10' . These errors are typically resolved by the parser detecting syntax issues and suggesting correct syntax for the command .

Query processing involves three main components: Parsing and Translation, Optimization, and Evaluation. During Parsing and Translation, the query is checked for syntax errors and translated into relational algebra. For instance, a query like 'SELECT RollNo, name FROM Student HAVING RollNo=10' would be corrected to 'SELECT RollNo, name FROM Student WHERE RollNo=10' to avoid a syntax error . Optimization involves generating multiple query evaluation plans and selecting the one with the lowest cost based on database statistics, such as the number of tuples . In the Evaluation phase, the chosen plan is executed by the query-execution engine to return the query results .

Query optimization uses statistical information from the database catalog, including the number of tuples in each relation and tuple sizes, to estimate the cost of different query evaluation plans. This information helps in selecting the plan with the lowest estimated cost, ensuring efficient query execution . For instance, by knowing the sizes and distributions of data, the optimizer can determine the most efficient order and method to execute join operations or selections .

You might also like