Some concept of Database Management Systems are Access Methods Layer, Basic Structure, Common Structures, Designing Systems, Join Processing, Modern Computers, Query Evaluation Techniques. Main points of this lecture are: Query Evaluation Techniques, Different, Algorithms, Execute, Relational Operators, Selection, Projection, Joins, Aggregates, Engine
Download Query Evaluation Techniques - Database Management Systems - Lecture Slides and more Slides Introduction to Database Management Systems in PDF only on Docsity!
Database Management Systems Design
Query Evaluation Techniques
Read :
Chapter 12, sec 12.1-12.
Chapter 13
Purpose:
Study different algorithms to execute (evaluate) SQL relational operators - Selection - Projection - Joins - Aggregates - Etc.
Processing a query
Parser –
transforms query into a tree expression (parse tree)
Looks into catalog for metadata about tables, attributes, operators, etc.
Optimizer
transforms query expression tree into a query plan tree
Tree with metadata about relations, attributes, operators, and algorithms to run each operator
Searches several alternative query plan trees to find the cheapest - Based on I/O cost, CPU cost (and network cost)
Execution Engine
Takes the plan from optimizer, interprets it and runs it.
Issues in selecting a query plan
Need to understand cost of different plan
Plan – algorithm to run a given relational operator
Example- Selection: “Get all students with gpa = 4.00”
Plan 1 – scan heap file to find records with gap 4.
Plan 2 – Use an index on gpa to find records with 4.
Plan 3 – Sort table students on gap attribute, then scan sorted records for those with gpa = 4.
Need to have statistics about:
Relation size, attribute size
Distribution of attribute values
Uniform vs skewed
Disk speed
Memory size
Etc.
What information is stored?
Table
Table name
File that stores and file type (heap file, clustered B+ tree, …)
Attributes names and types
Indices defined on the table
Integrity constrains
Statistics
Index
Index name and type of structure (B+ tree, external hash, …)
Search key
Statistics
Views
View name and definition
What are the statistics?
Relational Cardinality
Number of tuples in table R : Ntuples(R)
Relation Size
Number of pages used to store R : NPages(R)
Index Cardinality
Number of distinct key values in index I : NKeys(I)
Index size
Number of pages for index I: NPages(I)
B+-tree – number of leaf pages
Number of Tuples Per Page
Number of tuples in a page (avg) R or I: NTPages(R)
Index Height
Number of non-leaf levels: IHeight(I)
Index Range
Min and max values in the index: ILow(I) and IHigh(I)