CS计算机代考程序代写 SQL 2021/4/28 Query Processing

2021/4/28 Query Processing
Query Processing
Query Processing Terminology Variations
>>
COMP9315 21T1 ♢ Query Processing ♢ [0/6]
https://cgi.cse.unsw.edu.au/~cs9315/21T1/lectures/qry-processing/slides.html 1/8

2021/4/28 Query Processing
❖ Query Processing
∧ >>
COMP9315 21T1 ♢ Query Processing ♢ [1/6]
https://cgi.cse.unsw.edu.au/~cs9315/21T1/lectures/qry-processing/slides.html 2/8

2021/4/28 Query Processing
❖ Query Processing (cont) A query in SQL:
states what kind of answers are required (declarative) does not say how they should be computed (procedural)
A query evaluator/processor : takesdeclarativedescriptionofquery (inSQL)
parsesquerytointernalrepresentation (relational algebra)
determinesplanforansweringquery (expressedasDBMS ops)
executesmethodviaDBMSengine (toproduceresult tuples)
Some DBMSs can save query plans for later re-use.
COMP9315 21T1 ♢ Query Processing ♢ [2/6]
<< ∧ >>
https://cgi.cse.unsw.edu.au/~cs9315/21T1/lectures/qry-processing/slides.html 3/8

2021/4/28 Query Processing
<< ∧ >>
❖ Query Processing (cont)
Internals of the query evaluation “black-box”:
COMP9315 21T1 ♢ Query Processing ♢ [3/6]
https://cgi.cse.unsw.edu.au/~cs9315/21T1/lectures/qry-processing/slides.html 4/8

2021/4/28 Query Processing
❖ Query Processing (cont)
DBMSs provide several “avours” of each RA operation. For example:
several “versions” of selection (σ ) are available each version is effective for a particular kind of
selection, e.g
select * from R where id = 100 — hashing select * from S — Btree index where age > 18 and age < 35 select * from T -- MALH file where a = 1 and b = 'a' and c = 1.4 Similarly, π and ⨝ have versions to match specic query types. COMP9315 21T1 ♢ Query Processing ♢ [4/6] << ∧ >>
https://cgi.cse.unsw.edu.au/~cs9315/21T1/lectures/qry-processing/slides.html 5/8

2021/4/28 Query Processing
<< ∧ >>
❖ Query Processing (cont)
We call these specialised version of RA operations
RelOps.
One major task of the query processor:
given a RA expression to be evaluated
nd a combination of RelOps to do this efciently
Requires the query translator/optimiser to consider information about relations (e.g. sizes, primary keys, …) information about operations (e.g. selection reduces size)
RelOps are realised at execution time
as a collection of inter-communicating nodes
communicating either via pipelines or temporary relations
COMP9315 21T1 ♢ Query Processing ♢ [5/6]
https://cgi.cse.unsw.edu.au/~cs9315/21T1/lectures/qry-processing/slides.html 6/8

2021/4/28 Query Processing
❖ Terminology Variations Relational algebra expression of SQL query
intermediate query representation logical query plan
Execution plan as collection of RelOps query evaluation plan
query execution plan
physical query plan
Representation of RA operators and expressions σ = Select = Sel, π = Project = Proj R⨝S=RJoinS=Join(R,S), ∧=&, ∨=|
COMP9315 21T1 ♢ Query Processing ♢ [6/6]
<< ∧ https://cgi.cse.unsw.edu.au/~cs9315/21T1/lectures/qry-processing/slides.html 7/8 2021/4/28 Query Processing Produced: 5 Apr 2021 https://cgi.cse.unsw.edu.au/~cs9315/21T1/lectures/qry-processing/slides.html 8/8