Query Execution Presented by Khadke, Suvarna CS 257

Slides:



Advertisements
Similar presentations
CS4432: Database Systems II
Advertisements

CS 245Notes 71 CS 245: Database System Principles Notes 7: Query Optimization Hector Garcia-Molina.
CS 540 Database Management Systems
CS CS4432: Database Systems II Operator Algorithms Chapter 15.
Completing the Physical-Query-Plan. Query compiler so far Parsed the query. Converted it to an initial logical query plan. Improved that logical query.
Query Execution Optimizing Performance. Resolving an SQL query Since our SQL queries are very high level, the query processor must do a lot of additional.
COMP 451/651 Optimizing Performance
Query Execution Professor: Dr T.Y. Lin Prepared by, Mudra Patel Class id: 113.
Query Execution Professor: Dr T.Y. Lin Prepared by, Mudra Patel Class id: 113.
CS 245Notes 71 CS 245: Database System Principles Notes 7: Query Optimization Hector Garcia-Molina.
Lecture 24: Query Execution Monday, November 20, 2000.
CS 257, Spring’08 Presented By: Presented By: Gayatri Gopalakrishnan Gayatri Gopalakrishnan ID : 201.
15.6 Index-Based Algorithms Sadiya Hameed ID: 206 CS257.
1 Lecture 22: Query Execution Wednesday, March 2, 2005.
1 Anna Östlin Pagh and Rasmus Pagh IT University of Copenhagen Advanced Database Technology March 25, 2004 QUERY COMPILATION II Lecture based on [GUW,
Query Execution Professor: Dr T.Y. Lin Prepared by, Mudra Patel Class id: 113.
16.5 Introduction to Cost- based plan selection Amith KC Student Id: 109.
Query Compiler: 16.7 Completing the Physical Query-Plan CS257 Spring 2009 Professor Tsau Lin Student: Suntorn Sae-Eung ID: 212.
15.3 Nested-Loop Joins - Medha Pradhan - ID: CS 257 Section 2 - Spring 2008.
Query Execution Chapter 15 Section 15.1 Presented by Khadke, Suvarna CS 257 (Section II) Id
1 Relational Operators. 2 Outline Logical/physical operators Cost parameters and sorting One-pass algorithms Nested-loop joins Two-pass algorithms.
CSCE Database Systems Chapter 15: Query Execution 1.
Database Management 9. course. Execution of queries.
CPS216: Advanced Database Systems Notes 07:Query Execution Shivnath Babu.
Chapter 13 Query Processing Melissa Jamili CS 157B November 11, 2004.
Query Execution Section 15.1 Shweta Athalye CS257: Database Systems ID: 118 Section 1.
CSE 544: Relational Operators, Sorting Wednesday, 5/12/2004.
CS4432: Database Systems II Query Processing- Part 3 1.
CS 257 Chapter – 15.9 Summary of Query Execution Database Systems: The Complete Book Krishna Vellanki 124.
16.7 Completing the Physical- Query-Plan By Aniket Mulye CS257 Prof: Dr. T. Y. Lin.
CS4432: Database Systems II Query Processing- Part 2.
Lecture 17: Query Execution Tuesday, February 28, 2001.
CS 440 Database Management Systems Lecture 5: Query Processing 1.
CS 540 Database Management Systems
1 Lecture 23: Query Execution Monday, November 26, 2001.
Query Processing COMP3017 Advanced Databases Nicholas Gibbins
CS4432: Database Systems II Query Processing- Part 1 1.
Query Execution Chapter 15 Section 15.1 Presented by Khadke, Suvarna CS 257 (Section II) Id
Chiu Luk CS257 Database Systems Principles Spring 2009
15.1 – Introduction to physical-Query-plan operators
CS 540 Database Management Systems
CS 440 Database Management Systems
Database Management System
Prepared by : Ankit Patel (226)
Chapter 12: Query Processing
Data Engineering Query Optimization (Cost-based optimization)
CPSC-608 Database Systems
COST ESTIMATION FOR THE RELATIONAL ALGEBRA OPERATIONS MIT 813 GROUP 15 PRESENTATION.
Chapter 15 QUERY EXECUTION.
Database Management Systems (CS 564)
Examples of Physical Query Plan Alternatives
File Processing : Query Processing
Sidharth Mishra Dr. T.Y. Lin CS 257 Section 1 MH 222 SJSU - Fall 2016
Query Processing B.Ramamurthy Chapter 12 11/27/2018 B.Ramamurthy.
Query Optimization CS 157B Ch. 14 Mien Siao.
Chapters 15 and 16b: Query Optimization
One-Pass Algorithms for Database Operations (15.2)
Query Execution Presented by Jiten Oswal CS 257 Chapter 15
Relational Algebra Friday, 11/14/2003.
Chapter 12 Query Processing (1)
Overview of Query Evaluation
Query Execution Index Based Algorithms (15.6)
CS222P: Principles of Data Management Notes #13 Set operations, Aggregation, Query Plans Instructor: Chen Li.
Lecture 23: Query Execution
Evaluation of Relational Operations: Other Techniques
CPSC-608 Database Systems
External Sorting Sorting is used in implementing many relational operations Problem: Relations are typically large, do not fit in main memory So cannot.
Query Processing.
Completing the Physical-Query-Plan and Chapter 16 Summary ( )
Lecture 20: Query Execution
Presentation transcript:

Query Execution Presented by Khadke, Suvarna CS 257 Chapter 15 Section 15.1 Presented by Khadke, Suvarna CS 257 (Section II) Id 213

Agenda Query Processor and major parts of Query processor Physical-Query-Plan Operators Scanning Tables Basic approaches to locate the tuples of a relation R Sorting While Scanning Tables Computation Model for Physical Operator I/O Cost for Scan Operators Iterators

Query Processor Group of components of a DBMS that converts a user queries and data-modification commands into a sequence of database operations It also executes those operations Must supply detail regarding how the query is to be executed

Major parts of Query processor Query execution: The algorithms that manipulate the data of the database. Focus on the operations of extended relational algebra.

Outline of Query Compilation Parsing : A parse tree for the query is constructed Query Rewrite : The parse tree is converted to an initial query plan (algebraic representation of the query). And transformed into logical query plan (less time) Physical Plan Generation : Logical Q Plan is converted into physical query plan by selecting algorithms and order of execution of these operator.

Physical-Query-Plan Operators Physical operators are implementations of the operator of relational algebra. They can also be use in non relational algebra operators like “scan” which scans tables.

Scanning Tables One of the basic thing we can do in a Physical query plan is to read the entire contents of a relation R. Variation of this operator involves simple predicate Read only those tuples of the relation R that satisfy the predicate.

Basic approaches to locate the tuples of a relation R Table Scan Relation R is stored in secondary memory with its tuples arranged in blocks It is possible to get the blocks one by one Index-scan If there is an index on any attribute of Relation R Can use this index to get all the tuples of R For Example: sparse index on R

Sorting While Scanning Tables Number of reasons to sort a relation Query could include an ORDER BY clause, requiring that a relation be sorted. Algorithms to implement relational algebra operations requires one or both arguments to be sorted relations. Physical-query-plan operator sort-scan takes a relation R, attributes on which the sort is to be made, and produces R in that sorted order Another reason : B-tree index on a, multiway merge-sort

Computation Model for Physical Operator Physical-Plan Operator should be selected wisely which is essential for good Query Processor . For “cost” of each operator is estimated by number of disk I/O’s for an operation. The total cost of operation depends on the size of the answer and includes the final write back cost to the total cost of the query.

Parameters for Measuring Costs B: The number of blocks are needed to hold all tuples of R. Also known as B(R) T:The number of tuples in R. Also known as T(R) V: The number of distinct values that appear in a column of a relation V(R, a)- is the number of distinct values of column for a in R

I/O Cost for Scan Operators If relation R is clustered, then the number of disk I/O for the table-scan operator is approximately B disk I/O’s If relation R is not clustered, then the number of required disk I/O generally is much higher A index on a relation R occupies many fewer than B(R) blocks That means a scan of the entire R which takes at least B disk I/O’s will require more I/O’s than the entire index

Iterators for Implementation of Physical Operators Many physical operators can be implemented as an Iterator. Three methods forming the iterator for an operation are: 1. Open( ) : This method starts the process of getting tuples It initializes any data structures needed to perform the operation

Iterators for Implementation of Physical Operators 2. GetNext( ): Returns the next tuple in the result Adjusts data structures as necessary to allow subsequent tuples to be obtained If there are no more tuples to return, GetNext returns a special value NotFound 3. Close( ) : Ends the iteration after all tuples It calls Close on any arguments of the operator

Reference ULLMAN, J. D., WISDOM J. & HECTOR G., DATABASE SYSTEMS THE COMPLETE BOOK, 2nd Edition, 2008.

Thank You