Sudhansu, DBMS 3rd
Sudhansu, DBMS 3rd
Assignment of DBMS-3rd
Name:-sudhansu
Branch: C S E ‘B’
Batch :-2k18
Roll no : 180280073/184075
Submitted to:-
Er.Shimardeep mam
Ans:-
Query processing includes translation of high-level queries into low-level
expressions that can be used at the physical level of the file system, query
optimization and actual execution of the query to get the result. It is a three-step
process that consists of parsing and translation, optimization and execution of the
query submitted by the user. These steps are discussed below:
• Step-1:
Parser: During parse call, the database performs the following checks- Syntax
check, Semantic check and Shared pool check, after converting the query into
relational algebra.
Parser performs the following checks as (refer detailed diagram):
• Syntax check – concludes SQL syntactic validity. Example: SELECT *
FORM employee
Here the error of wrong spelling of FROM is given by this check.
• Semantic check – determines whether the statement is meaningful or not.
Example: query contains a table name which does not exist is checked by this
check.
• Shared Pool check – Every query possesses a hash code during its
execution. So, this check determines the existence of written hash code in a
shared pool. If code exists in a shared pool then the database will not take
additional steps for optimization and execution.
• Step-2:
Optimizer: During optimization stage, 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
subquery that requires optimization.
It is a process in which multiple query execution plans for satisfying a query are
examined and the most efficient query plan is satisfied for execution.
Database catalog stores the execution plans and then optimizer passes the lowest
cost plan for execution.
Row Source Generation –
The Row Source Generation is a software that receives a optimal execution plan
from the optimizer and produces an iterative execution plan that is usable by the rest
of the database. the iterative plan is the binary program that when executes by the
sql engine produces the result set.
• Step-3:
Execution Engine: Finally runs the query and display the required result.
Ans:-
Relational algebra is a procedural query language, which takes instances of
relations as input and yields instances of relations as output. It uses
operators to perform queries. An operator can be either unary or binary. They
accept relations as their input and yield relations as their output.
When a query is placed, it is at first scanned, parsed and validated. An
internal representation of the query is then created such as a query tree or a
query graph. Then alternative execution strategies are devised for retrieving
results from the database tables.
We can have different equivalent expressions for different types of operations. The
Equivalence Rule defines how to write equivalent expressions for each of the operators.