Академический Документы
Профессиональный Документы
Культура Документы
1 – INTRODUCTION TO
PHYSICAL-QUERY-PLAN
OPERATORS
PRESENTED BY: JASON CHEE
QUERY PROCESSOR
• Query Processor:
Group of components
of a DBMS that turns
user queries and data-
modification
commands into a
sequence of database
operations and
executes those
operations
QUERY COMPILATION (CH 16)
• Three parts:
• Parsing: Construct parse
tree
• Query rewrite: parse tree ->
query algebra -> logical
query plan (faster)
• Physical plan generation:
Converts logical query plan
to physical query plan by
selecting appropriate
algorithms and order of
execution.
PHYSICAL-QUERY-PLAN
OPERATORS
• Physical Operators often are implementations of
relational algebra operators
• Examples of non-relational operators:
• Scan: bring into memory each tuple of some relation
• Iterators: method by which operators comprising a physical
query plan can pass requests for tuples and answers among
themselves
SCANNING TABLES
• Table-scan:
• If R is clustered, need B disk I/Os
• If R is not clustered, could be up to T disk I/Os – as many
blocks as there are tuples
• Index-scan:
• If column data is contained in the index
• SELECT category_id FROM tbl WHERE category_id BETWEEN 10
AND 100;
• Don’t need to access the table
• Often smaller than B
ITERATORS FOR IMPLEMENTATION OF
PHYSICAL OPERATORS
• Design pattern to implement physical operators
• Three Methods
• 1) Open(): Initializes data structures
• 2) GetNext(): Returns the next tuple in the result and
adjusts data structures as necessary.
• If no more tuples, return not found
• 3) Close(): Ends the iteration for all tuples. Calls close
on any arguments of the operator.
TABLE-SCAN ITERATOR METHODS
THANK YOU