Téléchargez aux formats PDF ou lisez en ligne sur Scribd
Short Questio
QI. Define query.
Answer:
A query refers to action of retrieving data from
your database. Query is expressed by using high level
language.
Q2. What is Query Processor?
‘Answer:
Itis a module in DBMS that performs the tasks
toprocess, to optimize, and fo generate execution strategy
fora high level query.
Q3._ Whatis Distributed query optimization?
‘Answer:
It refers to the process of producing a plan for
the processing of a query to a distributed database
system. The plan is called a query execution plan.
Q4. Define processing tree.
Answer:
A Processing tree islabelled binary tree where the
leaf nodes are relations of the input query and each
Tondeaf node isa temporary relation.
Q5. What is Search space?
Answer:
The search space is the set of altemative execution
‘lans that represent the input query.
Q6. Define Linear tree.
Answer:
A\linear tree is a tree that at least one operand of
oO) operator nodes a base relations oT eee
Q7. What is Row blocking?
Answer:
When a relation R is ship between different sites
the tuple in Rare sent across the network using a network
Protocol such as UDP or TCP Instead of sending tuples
‘he ata time tuples can be sent in blocks. This technique
Retledrow boeking,
Waning: Xen/Poiocopyng ofthe Bok sa CRIMINAL Act Anyone found gully is ZABLE face URGAL poccingy
QUERY PROCESSING AND
DECOMPOSITION
pets sen ee Ak a
Q8. Define query Optimization.
Answer:
Itrefers to the process of producing an optimal
execution plan for a given query, where optimality is
with respect to a cost function to be minimised.
Q9. What do you mean by Query
decomposition?
Answer:
It consists of scanning, parsing and validation
steps. The query parser checks the validity of query and
then translate it into an internal form,
Q10. Define plan in query processing.
Answer:
A Plan specifies precisely how the query isto be
executed. Probably every database system represents
lan in same way as trees.
QLL. What is query translation?
Answer:
Itgenerates a query that is semantically closest
to source query and syntactically valid to the target
schema.
eens oii fue
Q12. Importance of localization of distributed
data?
Answer:
Itean enhance the security of data by keeping it
within the borders of particular country.Qu.
5 a swers
Essay Questions with Answ
Query PROCESSING AND DECOMPOSITION
2.1.1 Query
PROCESSING OBJECTIVES
Describe in brief on query processing.
Answer:
‘Query: A query refers to the action of retrieving
data from your database. Query is expressed by using
high level language.
Query Processor:
‘A Query processor is a module in the DBMS that
performs the tas to process, to optimize, and to generate
execution strategy for high level query.
Objectives of Query Processing:
‘The main objectives of query processing in a
distributed envi
ERE
EEO)
|
18, February-2022, Q3(b)
Ee
ronment is to form a high level
query on a distributed database, which is seen in
a single database by the users, into an efficient
excecution strategy expressed in a low level
Janguage in local databases.
An important point of query processing is query
‘optimization. Becuase many execution strategies
‘are correct transformation of the smae high level
‘query the one that optimizes (minimizes) resource
‘consumtption should be retained.
‘The good measure of resource consumption are:
‘The total cost that will be incurred in processing
the query. It is
the dome of all times incurred in
‘Processing the operations of the query at various
‘sites and intrinsic communication.
‘The resource time of the query, This is the time
‘elapsed for executing the query. Since operations
canbe executed in parallel at different sted, the
Tesponse time of query may be significantly less
than its cost.
Obviously the total cost should be minimized.
In a distributed system, the total cost to be
‘minimized includes CPU), VO, and communication
Costs. This cost can be minimized by reducing
the number of VO operation through fast access
‘methods to the data and efficient use of main
Participating in the execution ofthe query.
In centralized
have tobe:
a ‘only CPU and UO cost
2.1.2 CHARACTERIZATION OF Query
PROCESSORS
Q2. Explain in brief on characteristics of query
Processing.
Answer:
Characterization of Query Processor: a
') The inputlanguage to the query processor can,
based on relational calculus and relational algebra
fi) —_ Query optimization is to select a best point of
solution space that leads to minimum cost.
ii) Optimization done statically before executing the
query or dynanically as the query is executed.
i») Dynamic query optimization require statistics in
‘order to choose the operation that has tobe deone
first.
¥) State query optimization requires statistics in order
to choose estimate the size of intermediate
relations.
vi) Distributed Query Processor exploits the network
topology.
Languages: The input language to the query
Processor can be based on relational calculus or relational
algebra." With object DBMS, the language is based on
‘object calculus which is merely an extension of relational
calculus. Thus, decomposition in object algebra is also
needed,
In a distributed context the output language is
generally some internal form of relational algebra
augmented with communication primitives, The
‘operations of the output language are implemented
directly in the system,
‘Types of Optimization: Query optimization
aims at choosing the best point in the solution space of
all possible execution strategies, An immediate method
for query optimization is to search the solution space,
exhaustively predict the cost of each strategy, and select
the strategy with minimum cost. This method is effective
in selecting the best strategy; it may incur a significant
Processing cost forthe optimization itself.
Optimization Timing: A query may
‘optimized at different, times relative to the actual
of query execution, Optimizaiai = ™ Distributed Databases
sate vee 2 ery optimisation relies on daliics on the database. Dynamic query
pinion ee In ardetto choose which operat ‘should be done first. Static query optimisation
Fa iat uted dae ae Beaker shies mata tr eee ee
ination. Ine dee ea abate, Salis for query optimnton ine hen Se
TI ee a etltel ie s> ond Wubber cf asin tied ches ok oe Pee
i pa anager at SEE Tamas Hebron ok nicole lee ie oveties ei he
distributed query optimisation, which can be divided
, based on intersite communication, and
processing algorithm.
processing time,
Q. Discuss in detail on Phases of Query Processing.
Code
“The abov figure shows of Query Processing
wanes “Act. Anyone found guilty is LIABLE to face LEGALOx
Distributed Databases m
a) Parser:
Infirst phase, the query is parsed and translated
into an internal representation that cand be easily
Processed by laterphases.
‘The passing and translation will first translate the
query in its internal form, then translate the query into
relational algebra and verifies relations.
b) Query rewrite:
It transforms a query in order to carry out
‘optimizations that are good regardless of physical state
of system,
co) Query Optimizer:
The Component carries out otpimizations that
depends on physical state of system. The optimizes
decides which indices to use to executed a query, which
‘methods to use to execute a operations of query.
a) Plan:
A plan specifies precisely how the query is to be
executed. Probably every database system represents
plans in the same way as trees. The nodes of a plan are
operations, and every operator carries out one particular
operation,
2) Code Operation:
Code generation is also called plan refines. This
component transforms the plan produced by the optimizer
into executable plan.
1) Query execution engine:
E ‘This component provides generic implementation
for every operator.
Catalog
me ‘Catalog stores all the information needed in
parse, rewrite and optimize a query, It maintains
schema and of database,
_____ Thequery exetuion engine is like a virtual machine
runs physical query plans.
Ina
and their
along with
The) ABy Aa
Pi V Po > Pa V By i
Pv (PePs) <> (Be APi)APy
P.v(P: ¥Ps) (Pi vPa) vy
PL A(PeY Ps) $(P, 4P2)v (Pi Ap)
Piv (Pe Ps) (Pi v Pa) A(B, vs)
=(P: AP 2) =P: Yop,
A(P, ¥ Pe) > =P; A=Py
ap.) P
Consider the followingquery:
“Fond the names of employees who have been
working on project p, for 12 to24 months”.
The query expressed in SQL is
SELECT ENAME
FROM EMP ASG
WHERE EMPENO = ASG. ENO
AND ASG,DNO= “P,*
AND DUR = 120R DUR = 24 3
The qualification in conjunctive normal form is
EMPENO = [Link] , [Link]
="P,” ,(DUR = 12 y DUR= 24) ;
The qualification in disjunction normal formis
(EMP ENO = [Link] , [Link] = ‘P,”
ADUR = 13) y,Distributed Databases m
Elimination of Redundancy:
Inparticular, a user query typically expressed on
a view may be enriched with several predica:
toa chieve view relation. comespondence, and
censure sermanticintegrity and security,
Scant ae eat
folloowing well known idempotency rules:
paper.
pyYP@P
pate &
pafasle
, p,be
SE oT EC Ena’>, and p, be .
‘The query qualification is
(+, 4(@: v2) apa) vps
‘The linesn ssc ;
obtained by appbinguleS 3
(-2.((P: 9-92) (bs A=P.))) vs
and then muel3
b)
Cor apanp,)v(-p, mos ‘
Misi |
Rewriting:
Example:
Byaplying rule 7
(false aps) (Ps false)
By applying same rule we get
(false v false) v Ps
is equivalent to p, by rule 4.
The last step of query decomposition rewrit
query in relational algebra. Thisis typically.
into following two sub stpes.
Straight forward transformation of query
telational calculus into relational algebra
Restructuring of relational algebra query
improve performance.
‘An operator tree is a tree in which a leaf node!
a relation stored in databack and ronleaf nod
is an intermediate relation.
Find the name of employees other than J.D