Query Processing B.Ramamurthy Chapter 12 11/27/2018 B.Ramamurthy.

Slides:



Advertisements
Similar presentations
Chapter 13: Query Processing
Advertisements

Copyright © 2007 Ramez Elmasri and Shamkant B. Navathe Slide
Copyright © 2004 Ramez Elmasri and Shamkant Navathe Elmasri/Navathe, Fundamentals of Database Systems, Fourth Edition Chapter 15-1 Query Processing and.
Chapter 15 Algorithms for Query Processing and Optimization Copyright © 2004 Pearson Education, Inc.
1 Lecture 8: Data structures for databases II Jose M. Peña
SPRING 2004CENG 3521 Query Evaluation Chapters 12, 14.
Query processing and optimization. Advanced DatabasesQuery processing and optimization2 Definitions Query processing –translation of query into low-level.
Quick Review of Apr 17 material Multiple-Key Access –There are good and bad ways to run queries on multiple single keys Indices on Multiple Attributes.
©Silberschatz, Korth and Sudarshan13.1Database System Concepts Chapter 13: Query Processing Overview Measures of Query Cost Selection Operation Sorting.
Query Processing (overview)
CSCI 5708: Query Processing I Pusheng Zhang University of Minnesota Feb 3, 2004.
ACS-4902 Ron McFadyen Chapter 15 Algorithms for Query Processing and Optimization.
ICS (072)Query Processing and Optimization 1 Chapter 15 Algorithms for Query Processing and Optimization ICS 424 Advanced Database Systems Dr.
CSCI 5708: Query Processing I Pusheng Zhang University of Minnesota Feb 3, 2004.
Bitmap Indexes.
Query Processing & Optimization
©Silberschatz, Korth and Sudarshan14.1Database System Concepts 3 rd Edition Chapter 14: Query Optimization Overview Catalog Information for Cost Estimation.
Query Processing Presented by Aung S. Win.
Database System Concepts, 5th Ed. ©Silberschatz, Korth and Sudarshan See for conditions on re-usewww.db-book.com Chapter 13: Query Processing.
CSCE Database Systems Chapter 15: Query Execution 1.
Database Management 9. course. Execution of queries.
©Silberschatz, Korth and Sudarshan13.1Database System Concepts Chapter 13: Query Processing Overview Measures of Query Cost Selection Operation Sorting.
Chapter 13 Query Processing Melissa Jamili CS 157B November 11, 2004.
Query Optimization Chap. 19. Evaluation of SQL Conceptual order of evaluation – Cartesian product of all tables in from clause – Rows not satisfying where.
Query Processing. Steps in Query Processing Validate and translate the query –Good syntax. –All referenced relations exist. –Translate the SQL to relational.
©Silberschatz, Korth and Sudarshan14.1Database System Concepts 3 rd Edition Chapter 14: Query Optimization Overview Catalog Information for Cost Estimation.
12.1Database System Concepts - 6 th Edition Chapter 12: Query Processing Overview Measures of Query Cost Selection Operation Join Operation Sorting 、 Other.
SCUHolliday - COEN 17814–1 Schedule Today: u Query Processing overview.
Database System Concepts, 5th Ed. ©Silberschatz, Korth and Sudarshan Chapter 13: Query Processing.
Temple University – CIS Dept. CIS331– Principles of Database Systems V. Megalooikonomou Query Processing (based on notes by C. Faloutsos at CMU)
Computing & Information Sciences Kansas State University Tuesday, 03 Apr 2007CIS 560: Database System Concepts Lecture 29 of 42 Tuesday, 03 April 2007.
Lecture 1- Query Processing Advanced Databases Masood Niazi Torshiz Islamic Azad university- Mashhad Branch
Chapter 12 Query Processing. Query Processing n Selection Operation n Sorting n Join Operation n Other Operations n Evaluation of Expressions 2.
Chapter 12 Query Processing (1) Yonsei University 2 nd Semester, 2013 Sanghyun Park.
Query Processing – Query Trees. Evaluation of SQL Conceptual order of evaluation – Cartesian product of all tables in from clause – Rows not satisfying.
1 B + -Trees: Search  If there are n search-key values in the file,  the path is no longer than  log  f/2  (n)  (worst case).
File Processing : Query Processing 2008, Spring Pusan National University Ki-Joune Li.
Query Processing and Query Optimization Database System Implementation CSE 507 Some slides adapted from Silberschatz, Korth and Sudarshan Database System.
Query Processing and Optimization Muheet Ahmed Butt.
Chapter 13: Query Processing
CHAPTER 19 Query Optimization. CHAPTER 19 Query Optimization.
Chapter 4: Query Processing
Storage Access Paging Buffer Replacement Page Replacement
15.1 – Introduction to physical-Query-plan operators
Database Management System
Secondary Storage Data Retrieval.
Chapter 12: Query Processing
COST ESTIMATION FOR THE RELATIONAL ALGEBRA OPERATIONS MIT 813 GROUP 15 PRESENTATION.
Chapter 15 QUERY EXECUTION.
File Processing : Query Processing
Query Processing and Optimization
C. Faloutsos Query Optimization – part 1
Yan Huang - CSCI5330 Database Implementation – Access Methods
Query Processing.
Chapter 13: Query Processing
Query processing and optimization
Chapter 13: Query Processing
CS143:Evaluation and Optimization
Chapter 13: Query Processing
Chapter 13: Query Processing
Lecture 2- Query Processing (continued)
Indexing and Hashing B.Ramamurthy Chapter 11 2/5/2019 B.Ramamurthy.
Chapter 13: Query Processing
Chapter 12 Query Processing (1)
Chapter 13: Query Processing
Query processing and optimization
Chapter 13: Query Processing
Chapter 13: Query Processing
Query Processing.
Presentation transcript:

Query Processing B.Ramamurthy Chapter 12 11/27/2018 B.Ramamurthy

Introduction Query processing refers to activities including translation of HLL queries into operations at physical file level, query-optimization transformations, and actual evaluation of queries. Objective of most query processing algorithms is to reduce the number of disk access which dominates the cost of query processing. 11/27/2018 B.Ramamurthy

Query Processing Steps Parsing and translation: checks the validity and translates to relational algebraic expression. Optimization : analogous to algebraic simplification Evaluation : many ways of evaluation. 11/27/2018 B.Ramamurthy

Steps in Query Processing Parser & Translator Relational Algebra Expressions Query Stats about data Optimizer Query Output Evaluation Engine Execution Plan data data 11/27/2018 B.Ramamurthy

Query Processing Steps : Example Select balance From account Where balance < 2500 Can be translated into either of the following: s balance < 2500 ( p balance (account)) p balance (s balance< 2500 (account)) 11/27/2018 B.Ramamurthy

Evaluation To specify how to evaluate the query we need to provide relational algebra expressions as well as annotate it with how to evaluate each operation. This annotation is known as evaluation primitive. Several primitives together form a pipeline. A sequence of primitives together form a query-execution plan or query-evaluation plan. Query execution engine evaluates the query. 11/27/2018 B.Ramamurthy

A Query-evaluation Plan p balance s balance< 2500 account Different evaluation plans will have different costs. It is Upto the system to decide the most efficient plan. 11/27/2018 B.Ramamurthy

Query Optimization Query optimization is the process of selecting the most efficient query evaluation plan for a query. Optimizers use statistical data about relations such as relation sizes and index depths to make a good estimate of cost of a plan. We will look at cost model, cost of individual operations selection, sorting, join, and other operations. 11/27/2018 B.Ramamurthy

Catalog Information Relevant catalog information about relations includes: nr , number of tuples in the relation br , number of blocks containing relation r sr , size of a tuple of relation r in bytes fr , blocking factor, number of tuples/block V(A,r), number of distinct values that appear in the relation r for attribute A. SC(A,r), selection cardinality of attribute A of relation r. Average number of records that satisfy equality condition for attribute A. 1 if A is key attribute, A(A,r) / nr for one distributed evenly. 11/27/2018 B.Ramamurthy

Information about indices Information about the indices are also maintained in the statistical database: fi , average fan out of internal nodes in a B+ tree index. HTi , number of levels of the index tree. LBi , number of lowest level index blocks in the index tree. All stats are usually registered for during DB updates. 11/27/2018 B.Ramamurthy

Measures of Query Cost Disk access dominates the cost. Assume all transfers of blocks cost the same. Number of block transfers from the memory for query will be the measure we will use. Cost also depends on main memory buffer. We assume 1 block / relation main memory buffer. 11/27/2018 B.Ramamurthy

Selection Operation Selection using linear search Selection using binary search .. Using indices : primary and secondary Selection involving comparisons Implementation of complex selections 11/27/2018 B.Ramamurthy

Join Operation There are several algorithms available for computing join. Lets analyze and compare them. 11/27/2018 B.Ramamurthy

11/27/2018 B.Ramamurthy

11/27/2018 B.Ramamurthy