Query Evaluation Overview. Query Optimization: Chap. 15. Evaluation Example. Cost Estimation. Query Blocks. Query Blocks

Size: px
Start display at page:

Download "Query Evaluation Overview. Query Optimization: Chap. 15. Evaluation Example. Cost Estimation. Query Blocks. Query Blocks"

Transcription

1 Query Evaluation Overview Query Optimization: Chap. 15 CS634 Leture 12 SQL query first translated to relational algebra (RA) Atually, some additional operators needed for SQL Tree of RA operators, with hoie of algorithm among available implementations for eah operator Main issues in query optimization For a given query, what plans are onsidered? Algorithm to searh plan spae for heapest (estimated) plan How is the ost of a plan estimated? Objetive Ideally: Find best plan Pratially: Avoid worst plans! Slides based on Database Management Systems 3 rd ed, Ramakrishnan and Gehrke Evaluation Example FROM Reserves R, Sailors S WHERE R.sid=S.sid AND R.bid=100 AND S.rating>5 Annotated Tree sname bid=100 rating > 5 sid=sid (On-the-fly) (On-the-fly) (Simple Nested Loops) Cost Estimation For eah plan onsidered, must estimate: Cost of eah operator in plan tree Depends on input ardinalities Operation and aess type: sequential san, index san, joins Size of result for eah operation in tree Use information about the input relations For seletions and joins, assume independene of prediates Reserves Sailors Query Bloks SQL query parsed into a olletion of query bloks Bloks are optimized one at a time Nested bloks an be treated as alls to a subroutine One all made one per outer tuple In some ases ross-blok optimization is possible A good query optimizer an unnest queries Outer blok WHERE S.age IN (SELECT MAX (S2.age) 2) Nested blok Query Bloks WHERE S.age IN (SELECT MAX (S2.age) 2) In fat this is an unorrelated subquery: The inner blok an be evaluated one!

2 Query Bloks WHERE S.age IN (SELECT MAX (S2.age) 2 WHERE S2.rating = S.rating) Looking for sailors who are of max age in their own rating group. Correlated subquery: eah row in S needs its own exeution of the inner blok Blok Optimization Blok = Unit of optimization For eah blok, onsider: 1. All available aess methods, for eah relation in FROM lause 2. All left-deep join trees Left-deep defined pg. 415: right hild of eah join is a base table Start with all ways to join the relations one-at-a-time Consider all relation permutations and join methods Reall: Left table = outer table of a nested loop join Left table of NLJ an be pipelined: rows used one at a time in order But need to onsider other join methods too, giving up pipelining in many ases Expressions Query is simplified to a seletion-projetion-ross produt expression Aggregation and grouping an be done afterwards Optimization with respet to suh expressions Cross-produt inludes oneptually joins Will talk about equivalenes in a bit Statistis and Catalogs To hoose an effiient plan, we need information about the relations and indexes involved Catalogs ontain information suh as: Tuple ount (NTuples) and page ount (NPages) for eah relation Distint key value ount (NKeys) for eah index, INPages Index height, low/high key values (Low/High) for eah tree index Histograms of the values in some fields (optional) Catalogs updated periodially Approximate information used, slight inonsisteny is ok Databases provide tools for updating stats on demand Size Estimation and Redution Fators SELECT attribute list FROM relation list WHERE term 1 AND... AND term k Maximum number of tuples is ardinality of ross produt Redution fator (RF) assoiated with eah term reflets its impat in reduing result size Impliit assumption that terms are independent! ol = value has RF =1/NKeys(I), given index I on ol ol1 = ol2 has RF = 1/max(NKeys(I1), NKeys(I2)) ol > value has RF = (High(I)-value)/(High(I)-Low(I)) Example: rating > 6 has RF = 4/10 = 0.4 Histograms Most often, data values are not uniformly distributed within domain Skewed distributions result in inaurate ost estimations Histograms More aurate statistis Break up the domain into bukets Store the ount of reords that fall in eah buket Tradeoff Histograms are aurate, but take some spae The more fine-grained the partition, the better auray But more spae required

3 Histogram Classifiation Equiwidth Domain split into equal-length partitions Large differene between ounts in different bukets Dense areas not suffiiently haraterized Equidepth Histograms adapts to data distribution Fewer bukets in sparse areas, more bukets in dense areas Used by Orale (pg. 485) Why are they important? They allow us to: Convert ross-produts to joins Cross produts should always be avoided (when possible) Choose different join orders Reall that hoie of outer/inner influenes ost Push-down seletions and projetions ahead of joins When doing so dereases ost Seletions: 1... nr 1... nr Casade property: R R Casade Commute Allows us to hek multiple onditions in same pass Allows us to push down only partial onditions (when not possible/advantageous to push entire ondition) Projetions: a1r a1... anr Casade If every a i set is inluded in a i+1, Example: a1 = {a,b}, a2 = {a,b,} a2 (T) has (a, b, ) olumns a1 ( a2 (T)) has (a,b) olumns, same as a1 (T) Joins: Joins: (R S) (S R) Commute (R S) (S R) Commute R (S T) (R S) T Assoiative R (S T) (R S) T Assoiative Sketh of proof: Show for ross produt Add join onditions as seletion operators Use asading seletions in assoiative ase Commutative property: Allows us to hoose whih relation is inner/outer Assoiative property: Allows us to restrit plans to left-deep only, i.e., any query tree an be turned into a left-deep tree.

4 Commuting seletions with projetions Projetion an be done before seletion if all attributes in the ondition evaluation are retained by the projetion R) ( ) ( R a a Commute seletion with join Only if all attributes in ondition appear in one relation and not in the other: inludes only attributes from R R S R S Condition an be deomposed and pushed down before joins R S R S Here, 1 inludes only attributes from R and 2 only attributes from S Commute projetion with join Only if attributes in join ondition appear in the orresponding projetion lists (so they aren t projeted out ) R S R S) a a1 a 2( System R Optimizer Developed at IBM starting in the 1970 s Most widely used urrently; works well for up to 10 joins Cost estimation Statistis maintained in system atalogs Used to estimate ost of operations and result sizes Query Plan Spae Only the spae of left-deep plans is onsidered Left-deep plans allow output of eah operator to be pipelined into the next operator without storing it in a temporary relation Cartesian produts avoided System R Optimizer Developed at IBM starting in the 1970 s Most widely used urrently; works well for up to 10 joins Cost estimation Statistis maintained in system atalogs Used to estimate ost of operations and result sizes Query Plan Spae Only the spae of left-deep plans is onsidered Left-deep plans allow output of eah operator to be pipelined into the next operator without storing it in a temporary relation Cartesian produts avoided SQL Query Semantis (pg. 136, 156) 1. ompute the ross produt of tables in FROM 2. delete rows that fail the WHERE lause 3. projet out olumns not mentioned in selet list or group by or having lauses 4. group rows by GROUP BY 5. apply HAVING to the groups, dropping some out 6. if neessary, apply DISTINCT 7. if neessary, apply ORDER BY Note this all follows the order of the SELECT lauses, exept for projetion and DISTINCT, so it s not hard to remember.

5 Single-Relation Plans Single-Relation Plans FROM lause ontains single relation Query is ombination of seletion, projetion, and aggregates (possibly GROUP BY and HAVING, but these ome late in the logial progression, so usually less ruial to planning) Main issue is to selet best from all available aess paths (either file san or index) Aess path involves the table and the WHERE lause Another fator is whether the output must be sorted E.g., GROUP BY requires sorting (or hashing) Sorting may be done as separate step, or using an index if an indexed aess path is available Plans Without Indexes Only aess path is file san Apply seletion and projetion to eah retrieved tuple Projetion may or may not use dupliate elimination, depending on whether there is a DISTINCT keyword present GROUP BY: Write out intermediate relation after seletion/projetion (or pipeline into sort) Sort intermediate relation to reate groups Apply aggregates on-the-fly per eah group HAVING also performed on-the-fly, no additional I/O needed Plans With Indexes There are four ases: 1. Single-index aess path Eah index offers an alternative aess path Choose one with lowest I/O ost Non-primary onjunts, projetion, aggregates/grouping applied next 2. Multiple-index aess path Eah index used to retrieve set of rids Rid sets interseted, result sorted by page id (Alternatively, join indexes as tables) Retrieve eah page only one Non-primary onjunts, projetion, aggregates/grouping applied next Plans With Indexes (ontd.) 3. Tree-index aess path: extra possible use If GROUP BY attributes prefix of tree index, retrieve tuples in order required by GROUP BY Apply seletion, projetion for eah retrieved tuple, then aggregate Works well for lustered indexes Example: With tree index on rating SELECT ount(*), max(age) GROUP BY rating Plans With Indexes (ontd.) 3. Index-only aess path If all attributes in query inluded in index, then there is no need to aess data reords: index-only san If index mathes seletion, even better: only part of index examined Does not matter if index is lustered or not! If GROUP BY attributes prefix of a tree index, no need to sort! Example: With tree index on rating SELECT max(rating),ount(*) Note ount(*) doesn t require aess to row, just RID.

6 Example Shema Sailors (sid: integer, sname: string, rating: integer, age: real) Reserves (sid: integer, bid: integer, day: dates, rname: string) Similar to old shema; rname added Reserves: 40 bytes long tuple, 100K reords, 100 tuples per page, 1000 pages Sailors: 50 bytes long tuple, 40K tuples, 80 tuples per page, 500 pages Assume index entry size 10% of data reord size Cost Estimates for Single-Relation Plans Sequential san of file: NPages(R) Index I on primary key mathes seletion Cost is Height(I)+1 for a B+ tree, about 1.2 for hash index Clustered index I mathing one or more onjunts: NPages(CI) * produt of RF s of mathing onjunts Quik estimate: Npages(CI) = 1.1*NPages(TableData) i.e. 10% more for needed keys Non-lustered index I mathing one or more onjunts: (NPages(I)+NTuples(R)) * produt of RF s of mathing onjunts Quik estimate: Npages(I) =.1*Npages(R) (10% of data size) Note: these formulas are not in the text, but are onsistent with the disussions and examples there. Example SELECT S.sid WHERE S.rating=8 File san: retrieve all 500 pages Clustered Index I on rating (1/NKeys(I)) * (NPages(CI)) = (1/10) * (50+500) pages Note: One rating value owns a fration (1/10) of the index at all levels, so #pages aessed = (1/10) Npages(CI) Or (1/10) Npages(I) Multiple-Relation Plans Unlustered Index I on rating (1/NKeys(I)) * (NPages(I)+NTuples(S)) = (1/10) * ( ) pages Queries Over Multiple Relations In System R only left-deep join trees are onsidered In order to restrit the searh spae Left-deep trees allow us to generate all fully pipelined plans Intermediate results not written to temporary files. Not all left-deep trees are fully pipelined (e.g., sort-merge join) A B C D A B Left-deep C D C A B D Enumeration of Left-Deep Plans Among all left-deep plans, we need to determine: the order of joining relations the aess method for eah relation the join method for eah join Enumeration done in N passes (if N relations are joined): Pass 1: Find best 1-relation plan for eah relation Pass 2: Find best way to join result of eah 1-relation plan (as outer) to another relation - result is the set of all 2-relation plans Pass N: Find best way to join result of a (N-1)-relation plan (as outer) to the N th relation - result is the set of all N-relation plans Speed-up omputation using dynami programming (remember details of good plans to avoid real)

7 Enumeration of Left-Deep Plans (ontd.) For eah subset of relations, retain only: Cheapest plan overall, plus Cheapest plan for eah interesting order of the tuples Interesting order: order that allows exeution of GROUP BY without requiring an additional step of sorting, aggregates Avoid Cartesian produts if possible An N-1 way plan is not ombined with an additional relation unless there is a join ondition between them Exeption is ase when all prediates in WHERE have been used up (i.e., query itself requires a ross-produt) Ex: selet from T1, T2, T3 where T1.x = T2.x Only one join ondition, 3 tables, so end up with ross produt Cost Estimation for Multi-Relation Plans Two omponents: 1. Size of intermediate relations Maximum tuple ount is the produt of the ardinalities of relations in the FROM lause Redution fator (RF) assoiated with eah ondition term Result ardinality estimate = Max # tuples * produt of all RF s Example query on next slide: Result ardinality estimate = (40K*100K) * ((1/100)*(5/10)*(1/40K)) = 500 This means we estimate the query returns 500 rows as its result It is not a ost alulation Here 1/40K = RF of join ondition, 1/100 assumes 100 boats. 2. Cost of eah join operator Depends on join method Example, Reserves R WHERE S.sid=R.sid AND S.rating>5 AND R.bid=100 sname bid=100 rating > 5 sname sid=sid Example Pass 1 Single-relation plans Sailors B+ tree mathes rating>5 Most seletive aess path But index unlustered! Sometimes may prefer san Reserves B+ tree on bid mathes seletion bid=100 Cheapest plan for this table Sailors: Unlustered B+ tree on rating Unlustered Hash on sid Reserves: Unlustered B+ tree on bid Reserves sid=sid Sailors bid=100 rating > 5 Reserves Sailors Note: Here we are evaluating plans as andidates for the leftmost spot in the final plan Result of Pass 1: One plan for eah table. But this is not left-deep! Example Pass 2 Consider eah plan retained from Pass 1 as the outer, and how to join it with the (only) other relation Sailors outer, Reserves inner No index mathes join ondition, this ould be done as blok nested loop Reserves outer, Sailors inner Sine we have hash index on sid for Sailors, this ould be a heap plan using an indexed nested loop This would mean S.rating>5 is done after join. Also see disussion of this on pg. 412, point 3 End up with left-deep plan. Example, ont. (pipelining not in book) Also need to hek sort-merge join But that requires materialization of input tables, an extra expense (or use pipelining into sort) Need to ost all three ompeting plans, hoose least expensive Note that left-deep plans assume nested-loop joins are in use, so may miss good hash join plans Note on pg. 500: Orale onsiders non-left-deep plans to better utilize hash joins.

8 Nested Queries Nested blok is optimized independently, with the outer tuple onsidered as providing a seletion ondition Outer blok is optimized with the ost of alling nested blok omputation taken into aount Impliit ordering of these bloks means that some good strategies are not onsidered The non-nested version of the query is typially optimized better Nested Queries WHERE EXISTS (SELECT * FROM Reserves R WHERE R.bid=103 AND R.sid=S.sid) Equivalent non-nested query:, Reserves R WHERE S.sid=R.sid AND R.bid=103

Relational Query Optimization

Relational Query Optimization Relational Query Optimization Module 4, Lectures 3 and 4 Database Management Systems, R. Ramakrishnan 1 Overview of Query Optimization Plan: Tree of R.A. ops, with choice of alg for each op. Each operator

More information

Query Optimization. Schema for Examples. Motivating Example. Similar to old schema; rname added for variations. Reserves: Sailors:

Query Optimization. Schema for Examples. Motivating Example. Similar to old schema; rname added for variations. Reserves: Sailors: Query Optimization Database Management Systems 3ed, R. Ramakrishnan and J. Gehrke 1 Schema for Examples (sid: integer, sname: string, rating: integer, age: real) (sid: integer, bid: integer, day: dates,

More information

Schema for Examples. Query Optimization. Alternative Plans 1 (No Indexes) Motivating Example. Alternative Plans 2 With Indexes

Schema for Examples. Query Optimization. Alternative Plans 1 (No Indexes) Motivating Example. Alternative Plans 2 With Indexes Schema for Examples Query Optimization (sid: integer, : string, rating: integer, age: real) (sid: integer, bid: integer, day: dates, rname: string) Similar to old schema; rname added for variations. :

More information

Query Optimization. Schema for Examples. Motivating Example. Similar to old schema; rname added for variations. Reserves: Sailors:

Query Optimization. Schema for Examples. Motivating Example. Similar to old schema; rname added for variations. Reserves: Sailors: Query Optimization atabase Management Systems 3ed, R. Ramakrishnan and J. Gehrke 1 Schema for Examples (sid: integer, sname: string, rating: integer, age: real) (sid: integer, bid: integer, day: dates,

More information

Relational Query Optimization. Overview of Query Evaluation. SQL Refresher. Yanlei Diao UMass Amherst October 23 & 25, 2007

Relational Query Optimization. Overview of Query Evaluation. SQL Refresher. Yanlei Diao UMass Amherst October 23 & 25, 2007 Relational Query Optimization Yanlei Diao UMass Amherst October 23 & 25, 2007 Slide Content Courtesy of R. Ramakrishnan, J. Gehrke, and J. Hellerstein 1 Overview of Query Evaluation Query Evaluation Plan:

More information

Review. Relational Query Optimization. Query Optimization Overview (cont) Query Optimization Overview. Cost-based Query Sub-System

Review. Relational Query Optimization. Query Optimization Overview (cont) Query Optimization Overview. Cost-based Query Sub-System Review Relational Query Optimization R & G Chapter 12/15 Implementation of single Relational Operations Choices depend on indexes, memory, stats, Joins Blocked nested loops: simple, exploits extra memory

More information

Relational Query Optimization. Highlights of System R Optimizer

Relational Query Optimization. Highlights of System R Optimizer Relational Query Optimization Chapter 15 Database Management Systems 3ed, R. Ramakrishnan and J. Gehrke 1 Highlights of System R Optimizer v Impact: Most widely used currently; works well for < 10 joins.

More information

Administrivia. Relational Query Optimization (this time we really mean it) Review: Query Optimization. Overview: Query Optimization

Administrivia. Relational Query Optimization (this time we really mean it) Review: Query Optimization. Overview: Query Optimization Relational Query Optimization (this time we really mean it) R&G hapter 15 Lecture 25 dministrivia Homework 5 mostly available It will be due after classes end, Monday 12/8 Only 3 more lectures left! Next

More information

Overview of Query Evaluation. Overview of Query Evaluation

Overview of Query Evaluation. Overview of Query Evaluation Overview of Query Evaluation Chapter 12 Database Management Systems 3ed, R. Ramakrishnan and J. Gehrke 1 Overview of Query Evaluation v Plan: Tree of R.A. ops, with choice of alg for each op. Each operator

More information

Overview of Implementing Relational Operators and Query Evaluation

Overview of Implementing Relational Operators and Query Evaluation Overview of Implementing Relational Operators and Query Evaluation Chapter 12 Motivation: Evaluating Queries The same query can be evaluated in different ways. The evaluation strategy (plan) can make orders

More information

Relational Query Optimization. Overview of Query Evaluation. SQL Refresher. Yanlei Diao UMass Amherst March 8 and 13, 2007

Relational Query Optimization. Overview of Query Evaluation. SQL Refresher. Yanlei Diao UMass Amherst March 8 and 13, 2007 Relational Query Optimization Yanlei Diao UMass Amherst March 8 and 13, 2007 Slide Content Courtesy of R. Ramakrishnan, J. Gehrke, and J. Hellerstein 1 Overview of Query Evaluation Query Evaluation Plan:

More information

CS330. Query Processing

CS330. Query Processing CS330 Query Processing 1 Overview of Query Evaluation Plan: Tree of R.A. ops, with choice of alg for each op. Each operator typically implemented using a `pull interface: when an operator is `pulled for

More information

Overview of Query Evaluation

Overview of Query Evaluation Overview of Query Evaluation Chapter 12 Database Management Systems 3ed, R. Ramakrishnan and J. Gehrke 1 Overview of Query Evaluation Plan: Tree of R.A. ops, with choice of alg for each op. Each operator

More information

Relational Query Optimization

Relational Query Optimization Relational Query Optimization Chapter 15 Ramakrishnan & Gehrke (Sections 15.1-15.6) CPSC404, Laks V.S. Lakshmanan 1 What you will learn from this lecture Cost-based query optimization (System R) Plan space

More information

Principles of Data Management. Lecture #12 (Query Optimization I)

Principles of Data Management. Lecture #12 (Query Optimization I) Principles of Data Management Lecture #12 (Query Optimization I) Instructor: Mike Carey mjcarey@ics.uci.edu Database Management Systems 3ed, R. Ramakrishnan and J. Gehrke 1 Today s Notable News v B+ tree

More information

QUERY OPTIMIZATION E Jayant Haritsa Computer Science and Automation Indian Institute of Science. JAN 2014 Slide 1 QUERY OPTIMIZATION

QUERY OPTIMIZATION E Jayant Haritsa Computer Science and Automation Indian Institute of Science. JAN 2014 Slide 1 QUERY OPTIMIZATION E0 261 Jayant Haritsa Computer Science and Automation Indian Institute of Science JAN 2014 Slide 1 Database Engines Main Components Query Processing Transaction Processing Access Methods JAN 2014 Slide

More information

Administrivia. CS 133: Databases. Cost-based Query Sub-System. Goals for Today. Midterm on Thursday 10/18. Assignments

Administrivia. CS 133: Databases. Cost-based Query Sub-System. Goals for Today. Midterm on Thursday 10/18. Assignments Administrivia Midterm on Thursday 10/18 CS 133: Databases Fall 2018 Lec 12 10/16 Prof. Beth Trushkowsky Assignments Lab 3 starts after fall break No problem set out this week Goals for Today Cost-based

More information

An SQL query is parsed into a collection of query blocks optimize one block at a time. Nested blocks are usually treated as calls to a subroutine

An SQL query is parsed into a collection of query blocks optimize one block at a time. Nested blocks are usually treated as calls to a subroutine QUERY OPTIMIZATION 1 QUERY OPTIMIZATION QUERY SUB-SYSTEM 2 ROADMAP 3. 12 QUERY BLOCKS: UNITS OF OPTIMIZATION An SQL query is parsed into a collection of query blocks optimize one block at a time. Nested

More information

Database Applications (15-415)

Database Applications (15-415) Database Applications (15-415) DMS Internals- Part X Lecture 21, April 7, 2015 Mohammad Hammoud Last Session: DMS Internals- Part IX Query Optimization Today Today s Session: DMS Internals- Part X Query

More information

Examples of Physical Query Plan Alternatives. Selected Material from Chapters 12, 14 and 15

Examples of Physical Query Plan Alternatives. Selected Material from Chapters 12, 14 and 15 Examples of Physical Query Plan Alternatives Selected Material from Chapters 12, 14 and 15 1 Query Optimization NOTE: SQL provides many ways to express a query. HENCE: System has many options for evaluating

More information

Evaluation of Relational Operations: Other Techniques. Chapter 14 Sayyed Nezhadi

Evaluation of Relational Operations: Other Techniques. Chapter 14 Sayyed Nezhadi Evaluation of Relational Operations: Other Techniques Chapter 14 Sayyed Nezhadi Schema for Examples Sailors (sid: integer, sname: string, rating: integer, age: real) Reserves (sid: integer, bid: integer,

More information

Query Evaluation Overview, cont.

Query Evaluation Overview, cont. Query Evaluation Overview, cont. Lecture 9 Slides based on Database Management Systems 3 rd ed, Ramakrishnan and Gehrke Architecture of a DBMS Query Compiler Execution Engine Index/File/Record Manager

More information

Query Evaluation Overview, cont.

Query Evaluation Overview, cont. Query Evaluation Overview, cont. Lecture 9 Feb. 29, 2016 Slides based on Database Management Systems 3 rd ed, Ramakrishnan and Gehrke Architecture of a DBMS Query Compiler Execution Engine Index/File/Record

More information

Principles of Data Management. Lecture #9 (Query Processing Overview)

Principles of Data Management. Lecture #9 (Query Processing Overview) Principles of Data Management Lecture #9 (Query Processing Overview) Instructor: Mike Carey mjcarey@ics.uci.edu Database Management Systems 3ed, R. Ramakrishnan and J. Gehrke 1 Today s Notable News v Midterm

More information

Announcement. Reading Material. Overview of Query Evaluation. Overview of Query Evaluation. Overview of Query Evaluation 9/26/17

Announcement. Reading Material. Overview of Query Evaluation. Overview of Query Evaluation. Overview of Query Evaluation 9/26/17 Announcement CompSci 516 Database Systems Lecture 10 Query Evaluation and Join Algorithms Project proposal pdf due on sakai by 5 pm, tomorrow, Thursday 09/27 One per group by any member Instructor: Sudeepa

More information

Database Systems. Announcement. December 13/14, 2006 Lecture #10. Assignment #4 is due next week.

Database Systems. Announcement. December 13/14, 2006 Lecture #10. Assignment #4 is due next week. Database Systems ( 料 ) December 13/14, 2006 Lecture #10 1 Announcement Assignment #4 is due next week. 2 1 Overview of Query Evaluation Chapter 12 3 Outline Query evaluation (Overview) Relational Operator

More information

Overview of Query Evaluation

Overview of Query Evaluation Overview of Query Evaluation Chapter 12 Database Management Systems 3ed, R. Ramakrishnan and J. Gehrke 1 Overview of Query Evaluation Plan: Tree of R.A. operators, with choice of algorithm for each operator.

More information

R & G Chapter 13. Implementation of single Relational Operations Choices depend on indexes, memory, stats, Joins Blocked nested loops:

R & G Chapter 13. Implementation of single Relational Operations Choices depend on indexes, memory, stats, Joins Blocked nested loops: Relational Query Optimization R & G Chapter 13 Review Implementation of single Relational Operations Choices depend on indexes, memory, stats, Joins Blocked nested loops: simple, exploits extra memory

More information

Evaluation of relational operations

Evaluation of relational operations Evaluation of relational operations Iztok Savnik, FAMNIT Slides & Textbook Textbook: Raghu Ramakrishnan, Johannes Gehrke, Database Management Systems, McGraw-Hill, 3 rd ed., 2007. Slides: From Cow Book

More information

ATYPICAL RELATIONAL QUERY OPTIMIZER

ATYPICAL RELATIONAL QUERY OPTIMIZER 14 ATYPICAL RELATIONAL QUERY OPTIMIZER Life is what happens while you re busy making other plans. John Lennon In this chapter, we present a typical relational query optimizer in detail. We begin by discussing

More information

Query Evaluation! References:! q [RG-3ed] Chapter 12, 13, 14, 15! q [SKS-6ed] Chapter 12, 13!

Query Evaluation! References:! q [RG-3ed] Chapter 12, 13, 14, 15! q [SKS-6ed] Chapter 12, 13! Query Evaluation! References:! q [RG-3ed] Chapter 12, 13, 14, 15! q [SKS-6ed] Chapter 12, 13! q Overview! q Optimization! q Measures of Query Cost! Query Evaluation! q Sorting! q Join Operation! q Other

More information

Midterm Review CS634. Slides based on Database Management Systems 3 rd ed, Ramakrishnan and Gehrke

Midterm Review CS634. Slides based on Database Management Systems 3 rd ed, Ramakrishnan and Gehrke Midterm Review CS634 Slides based on Database Management Systems 3 rd ed, Ramakrishnan and Gehrke Coverage Text, chapters 8 through 15 (hw1 hw4) PKs, FKs, E-R to Relational: Text, Sec. 3.2-3.5, to pg.

More information

Final Review. CS634 May 11, Slides based on Database Management Systems 3 rd ed, Ramakrishnan and Gehrke

Final Review. CS634 May 11, Slides based on Database Management Systems 3 rd ed, Ramakrishnan and Gehrke Final Review CS634 May 11, 2016 Slides based on Database Management Systems 3 rd ed, Ramakrishnan and Gehrke Coverage Text, chapters 8 through 18, 25 (hw1 hw6) PKs, FKs, E-R to Relational: Text, Sec. 3.2-3.5,

More information

QUERY OPTIMIZATION [CH 15]

QUERY OPTIMIZATION [CH 15] Spring 2017 QUERY OPTIMIZATION [CH 15] 4/12/17 CS 564: Database Management Systems; (c) Jignesh M. Patel, 2013 1 Example SELECT distinct ename FROM Emp E, Dept D WHERE E.did = D.did and D.dname = Toy EMP

More information

CompSci 516 Data Intensive Computing Systems

CompSci 516 Data Intensive Computing Systems CompSci 516 Data Intensive Computing Systems Lecture 9 Join Algorithms and Query Optimizations Instructor: Sudeepa Roy CompSci 516: Data Intensive Computing Systems 1 Announcements Takeaway from Homework

More information

Overview of Query Processing

Overview of Query Processing ICS 321 Fall 2013 Overview of Query Processing Asst. Prof. Lipyeow Lim Information & Computer Science Department University of Hawaii at Manoa 11/20/2013 Lipyeow Lim -- University of Hawaii at Manoa 1

More information

ECS 165B: Database System Implementa6on Lecture 7

ECS 165B: Database System Implementa6on Lecture 7 ECS 165B: Database System Implementa6on Lecture 7 UC Davis April 12, 2010 Acknowledgements: por6ons based on slides by Raghu Ramakrishnan and Johannes Gehrke. Class Agenda Last 6me: Dynamic aspects of

More information

Operator Implementation Wrap-Up Query Optimization

Operator Implementation Wrap-Up Query Optimization Operator Implementation Wrap-Up Query Optimization 1 Last time: Nested loop join algorithms: TNLJ PNLJ BNLJ INLJ Sort Merge Join Hash Join 2 General Join Conditions Equalities over several attributes (e.g.,

More information

Implementing Relational Operators: Selection, Projection, Join. Database Management Systems, R. Ramakrishnan and J. Gehrke 1

Implementing Relational Operators: Selection, Projection, Join. Database Management Systems, R. Ramakrishnan and J. Gehrke 1 Implementing Relational Operators: Selection, Projection, Join Database Management Systems, R. Ramakrishnan and J. Gehrke 1 Readings [RG] Sec. 14.1-14.4 Database Management Systems, R. Ramakrishnan and

More information

Query Optimization. Kyuseok Shim. KDD Laboratory Seoul National University. Query Optimization

Query Optimization. Kyuseok Shim. KDD Laboratory   Seoul National University. Query Optimization Query Optimization Kyuseok Shim KDD Laboratory http://kdd.snu.ac.kr/ Seoul National University 1 Query Optimization To process an SQL query, database systems must select the most efficient plan Very expensive

More information

Overview of Query Processing. Evaluation of Relational Operations. Why Sort? Outline. Two-Way External Merge Sort. 2-Way Sort: Requires 3 Buffer Pages

Overview of Query Processing. Evaluation of Relational Operations. Why Sort? Outline. Two-Way External Merge Sort. 2-Way Sort: Requires 3 Buffer Pages Overview of Query Processing Query Parser Query Processor Evaluation of Relational Operations Query Rewriter Query Optimizer Query Executor Yanlei Diao UMass Amherst Lock Manager Access Methods (Buffer

More information

Συστήματα Διαχείρισης Βάσεων Δεδομένων

Συστήματα Διαχείρισης Βάσεων Δεδομένων ΕΛΛΗΝΙΚΗ ΔΗΜΟΚΡΑΤΙΑ ΠΑΝΕΠΙΣΤΗΜΙΟ ΚΡΗΤΗΣ Συστήματα Διαχείρισης Βάσεων Δεδομένων Διάλεξη 7η: Query Processing Δημήτρης Πλεξουσάκης Τμήμα Επιστήμης Υπολογιστών QUERY PROCESSING: How to Optimize Relational

More information

System R Optimization (contd.)

System R Optimization (contd.) System R Optimization (contd.) Instructor: Sharma Chakravarthy sharma@cse.uta.edu The University of Texas @ Arlington Database Management Systems, S. Chakravarthy 1 Optimization Criteria number of page

More information

External Sorting Implementing Relational Operators

External Sorting Implementing Relational Operators External Sorting Implementing Relational Operators 1 Readings [RG] Ch. 13 (sorting) 2 Where we are Working our way up from hardware Disks File abstraction that supports insert/delete/scan Indexing for

More information

Query Processing and Query Optimization. Prof Monika Shah

Query Processing and Query Optimization. Prof Monika Shah Query Processing and Query Optimization Query Processing SQL Query Is in Library Cache? System catalog (Dict / Dict cache) Scan and verify relations Parse into parse tree (relational Calculus) View definitions

More information

CompSci 516 Data Intensive Computing Systems. Lecture 11. Query Optimization. Instructor: Sudeepa Roy

CompSci 516 Data Intensive Computing Systems. Lecture 11. Query Optimization. Instructor: Sudeepa Roy CompSci 516 Data Intensive Computing Systems Lecture 11 Query Optimization Instructor: Sudeepa Roy Duke CS, Fall 2017 CompSci 516: Database Systems 1 Announcements HW2 has been posted on sakai Due on Oct

More information

Overview of Query Evaluation. Chapter 12

Overview of Query Evaluation. Chapter 12 Overview of Query Evaluation Chapter 12 1 Outline Query Optimization Overview Algorithm for Relational Operations 2 Overview of Query Evaluation DBMS keeps descriptive data in system catalogs. SQL queries

More information

CSE 444: Database Internals. Section 4: Query Optimizer

CSE 444: Database Internals. Section 4: Query Optimizer CSE 444: Database Internals Section 4: Query Optimizer Plan for Today Problem 1A, 1B: Estimating cost of a plan You try to compute the cost for 5 mins We will go over the solution together Problem 2: Sellinger

More information

Final Exam Review 2. Kathleen Durant CS 3200 Northeastern University Lecture 23

Final Exam Review 2. Kathleen Durant CS 3200 Northeastern University Lecture 23 Final Exam Review 2 Kathleen Durant CS 3200 Northeastern University Lecture 23 QUERY EVALUATION PLAN Representation of a SQL Command SELECT {DISTINCT} FROM {WHERE

More information

CS 4604: Introduction to Database Management Systems. B. Aditya Prakash Lecture #10: Query Processing

CS 4604: Introduction to Database Management Systems. B. Aditya Prakash Lecture #10: Query Processing CS 4604: Introduction to Database Management Systems B. Aditya Prakash Lecture #10: Query Processing Outline introduction selection projection join set & aggregate operations Prakash 2018 VT CS 4604 2

More information

Query Optimization in Relational Database Systems

Query Optimization in Relational Database Systems Query Optimization in Relational Database Systems It is safer to accept any chance that offers itself, and extemporize a procedure to fit it, than to get a good plan matured, and wait for a chance of using

More information

Evaluation of Relational Operations. Relational Operations

Evaluation of Relational Operations. Relational Operations Evaluation of Relational Operations Chapter 14, Part A (Joins) Database Management Systems 3ed, R. Ramakrishnan and J. Gehrke 1 Relational Operations v We will consider how to implement: Selection ( )

More information

Faloutsos 1. Carnegie Mellon Univ. Dept. of Computer Science Database Applications. Outline

Faloutsos 1. Carnegie Mellon Univ. Dept. of Computer Science Database Applications. Outline Carnegie Mellon Univ. Dept. of Computer Science 15-415 - Database Applications Lecture #14: Implementation of Relational Operations (R&G ch. 12 and 14) 15-415 Faloutsos 1 introduction selection projection

More information

Learning Convention Propagation in BeerAdvocate Reviews from a etwork Perspective. Abstract

Learning Convention Propagation in BeerAdvocate Reviews from a etwork Perspective. Abstract CS 9 Projet Final Report: Learning Convention Propagation in BeerAdvoate Reviews from a etwork Perspetive Abstrat We look at the way onventions propagate between reviews on the BeerAdvoate dataset, and

More information

Database Applications (15-415)

Database Applications (15-415) Database Applications (15-415) DBMS Internals- Part VIII Lecture 16, March 19, 2014 Mohammad Hammoud Today Last Session: DBMS Internals- Part VII Algorithms for Relational Operations (Cont d) Today s Session:

More information

Evaluation of Relational Operations

Evaluation of Relational Operations Evaluation of Relational Operations Chapter 14 Comp 521 Files and Databases Fall 2010 1 Relational Operations We will consider in more detail how to implement: Selection ( ) Selects a subset of rows from

More information

Evaluation of Relational Operations

Evaluation of Relational Operations Evaluation of Relational Operations Chapter 12, Part A Database Management Systems, R. Ramakrishnan and J. Gehrke 1 Relational Operations We will consider how to implement: Selection ( ) Selects a subset

More information

Automatic Physical Design Tuning: Workload as a Sequence Sanjay Agrawal Microsoft Research One Microsoft Way Redmond, WA, USA +1-(425)

Automatic Physical Design Tuning: Workload as a Sequence Sanjay Agrawal Microsoft Research One Microsoft Way Redmond, WA, USA +1-(425) Automati Physial Design Tuning: Workload as a Sequene Sanjay Agrawal Mirosoft Researh One Mirosoft Way Redmond, WA, USA +1-(425) 75-357 sagrawal@mirosoft.om Eri Chu * Computer Sienes Department University

More information

Advances in Data Management Query Processing and Query Optimisation A.Poulovassilis

Advances in Data Management Query Processing and Query Optimisation A.Poulovassilis 1 Advances in Data Management Query Processing and Query Optimisation A.Poulovassilis 1 General approach to the implementation of Query Processing and Query Optimisation functionalities in DBMSs 1. Parse

More information

Query Evaluation (i)

Query Evaluation (i) ICS 421 Spring 2010 Query Evaluation (i) Asst. Prof. Lipyeow Lim Information & Computer Science Department University of Hawaii at Manoa 2/9/2010 Lipyeow Lim -- University of Hawaii at Manoa 1 Query Enumerate

More information

CAS CS 460/660 Introduction to Database Systems. Query Evaluation II 1.1

CAS CS 460/660 Introduction to Database Systems. Query Evaluation II 1.1 CAS CS 460/660 Introduction to Database Systems Query Evaluation II 1.1 Cost-based Query Sub-System Queries Select * From Blah B Where B.blah = blah Query Parser Query Optimizer Plan Generator Plan Cost

More information

Implementation of Relational Operations

Implementation of Relational Operations Implementation of Relational Operations Module 4, Lecture 1 Database Management Systems, R. Ramakrishnan 1 Relational Operations We will consider how to implement: Selection ( ) Selects a subset of rows

More information

Database Applications (15-415)

Database Applications (15-415) Database Applications (15-415) DBMS Internals- Part VI Lecture 14, March 12, 2014 Mohammad Hammoud Today Last Session: DBMS Internals- Part V Hash-based indexes (Cont d) and External Sorting Today s Session:

More information

15-415/615 Faloutsos 1

15-415/615 Faloutsos 1 Carnegie Mellon Univ. Dept. of Computer Science 15-415/615 - DB Applications Lecture #14: Implementation of Relational Operations (R&G ch. 12 and 14) 15-415/615 Faloutsos 1 Outline introduction selection

More information

Overview of DB & IR. ICS 624 Spring Asst. Prof. Lipyeow Lim Information & Computer Science Department University of Hawaii at Manoa

Overview of DB & IR. ICS 624 Spring Asst. Prof. Lipyeow Lim Information & Computer Science Department University of Hawaii at Manoa ICS 624 Spring 2011 Overview of DB & IR Asst. Prof. Lipyeow Lim Information & Computer Science Department University of Hawaii at Manoa 1/12/2011 Lipyeow Lim -- University of Hawaii at Manoa 1 Example

More information

Evaluation of Relational Operations

Evaluation of Relational Operations Evaluation of Relational Operations Yanlei Diao UMass Amherst March 13 and 15, 2006 Slides Courtesy of R. Ramakrishnan and J. Gehrke 1 Relational Operations We will consider how to implement: Selection

More information

Implementation of Relational Operations. Introduction. CS 186, Fall 2002, Lecture 19 R&G - Chapter 12

Implementation of Relational Operations. Introduction. CS 186, Fall 2002, Lecture 19 R&G - Chapter 12 Implementation of Relational Operations CS 186, Fall 2002, Lecture 19 R&G - Chapter 12 First comes thought; then organization of that thought, into ideas and plans; then transformation of those plans into

More information

Administriva. CS 133: Databases. General Themes. Goals for Today. Fall 2018 Lec 11 10/11 Query Evaluation Prof. Beth Trushkowsky

Administriva. CS 133: Databases. General Themes. Goals for Today. Fall 2018 Lec 11 10/11 Query Evaluation Prof. Beth Trushkowsky Administriva Lab 2 Final version due next Wednesday CS 133: Databases Fall 2018 Lec 11 10/11 Query Evaluation Prof. Beth Trushkowsky Problem sets PSet 5 due today No PSet out this week optional practice

More information

Introduction to Data Management. Lecture 14 (SQL: the Saga Continues...)

Introduction to Data Management. Lecture 14 (SQL: the Saga Continues...) Introduction to Data Management Lecture 14 (SQL: the Saga Continues...) Instructor: Mike Carey mjcarey@ics.uci.edu Database Management Systems 3ed, R. Ramakrishnan and J. Gehrke 1 Announcements v HW and

More information

Evaluation of Relational Operations: Other Techniques

Evaluation of Relational Operations: Other Techniques Evaluation of Relational Operations: Other Techniques Chapter 12, Part B Database Management Systems 3ed, R. Ramakrishnan and Johannes Gehrke 1 Using an Index for Selections v Cost depends on #qualifying

More information

Lecture 3 More SQL. Instructor: Sudeepa Roy. CompSci 516: Database Systems

Lecture 3 More SQL. Instructor: Sudeepa Roy. CompSci 516: Database Systems CompSci 516 Database Systems Lecture 3 More SQL Instructor: Sudeepa Roy Duke CS, Fall 2018 CompSci 516: Database Systems 1 Announcements HW1 is published on Sakai: Resources -> HW -> HW1 folder Due on

More information

CS330. Some Logistics. Three Topics. Indexing, Query Processing, and Transactions. Next two homework assignments out today Extra lab session:

CS330. Some Logistics. Three Topics. Indexing, Query Processing, and Transactions. Next two homework assignments out today Extra lab session: CS330 Indexing, Query Processing, and Transactions 1 Some Logistics Next two homework assignments out today Extra lab session: This Thursday, after class, in this room Bring your laptop fully charged Extra

More information

Query and Join Op/miza/on 11/5

Query and Join Op/miza/on 11/5 Query and Join Op/miza/on 11/5 Overview Recap of Merge Join Op/miza/on Logical Op/miza/on Histograms (How Es/mates Work. Big problem!) Physical Op/mizer (if we have /me) Recap on Merge Key (Simple) Idea

More information

Query Processing and Optimization

Query Processing and Optimization Query Processing and Optimization (Part-1) Prof Monika Shah Overview of Query Execution SQL Query Compile Optimize Execute SQL query parse parse tree statistics convert logical query plan apply laws improved

More information

Principles of Data Management. Lecture #13 (Query Optimization II)

Principles of Data Management. Lecture #13 (Query Optimization II) Principles of Data Management Lecture #13 (Query Optimization II) Instructor: Mike Carey mjcarey@ics.uci.edu Database Management Systems 3ed, R. Ramakrishnan and J. Gehrke 1 Today s Notable News v Reminder:

More information

CSIT5300: Advanced Database Systems

CSIT5300: Advanced Database Systems CSIT5300: Advanced Database Systems E11: Exercises on Query Optimization Dr. Kenneth LEUNG Department of Computer Science and Engineering The Hong Kong University of Science and Technology Hong Kong SAR,

More information

CSIT5300: Advanced Database Systems

CSIT5300: Advanced Database Systems CSIT5300: Advanced Database Systems L10: Query Processing Other Operations, Pipelining and Materialization Dr. Kenneth LEUNG Department of Computer Science and Engineering The Hong Kong University of Science

More information

CSE 444: Database Internals. Sec2on 4: Query Op2mizer

CSE 444: Database Internals. Sec2on 4: Query Op2mizer CSE 444: Database Internals Sec2on 4: Query Op2mizer Plan for Today Problem 1A, 1B: Es2ma2ng cost of a plan You try to compute the cost for 5 mins We go over the solu2on together Problem 2: Sellinger Op2mizer

More information

Lecture 3 SQL - 2. Today s topic. Recap: Lecture 2. Basic SQL Query. Conceptual Evaluation Strategy 9/3/17. Instructor: Sudeepa Roy

Lecture 3 SQL - 2. Today s topic. Recap: Lecture 2. Basic SQL Query. Conceptual Evaluation Strategy 9/3/17. Instructor: Sudeepa Roy CompSci 516 Data Intensive Computing Systems Lecture 3 SQL - 2 Instructor: Sudeepa Roy Announcements HW1 reminder: Due on 09/21 (Thurs), 11:55 pm, no late days Project proposal reminder: Due on 09/20 (Wed),

More information

Pipelined Multipliers for Reconfigurable Hardware

Pipelined Multipliers for Reconfigurable Hardware Pipelined Multipliers for Reonfigurable Hardware Mithell J. Myjak and José G. Delgado-Frias Shool of Eletrial Engineering and Computer Siene, Washington State University Pullman, WA 99164-2752 USA {mmyjak,

More information

CSE 544 Principles of Database Management Systems. Magdalena Balazinska Fall 2007 Lecture 9 - Query optimization

CSE 544 Principles of Database Management Systems. Magdalena Balazinska Fall 2007 Lecture 9 - Query optimization CSE 544 Principles of Database Management Systems Magdalena Balazinska Fall 2007 Lecture 9 - Query optimization References Access path selection in a relational database management system. Selinger. et.

More information

Converting ER to Relational Schema

Converting ER to Relational Schema Converting ER to Relational Schema Project P-number P-name Due-Date 0..* Assignment 0..* 0..* Manager 1..1 Employee SSN E-Name Office 1 1 CS386/586 Introduction to Database Systems, Lois Delcambre, David

More information

Gray Codes for Reflectable Languages

Gray Codes for Reflectable Languages Gray Codes for Refletable Languages Yue Li Joe Sawada Marh 8, 2008 Abstrat We lassify a type of language alled a refletable language. We then develop a generi algorithm that an be used to list all strings

More information

Extracting Partition Statistics from Semistructured Data

Extracting Partition Statistics from Semistructured Data Extrating Partition Statistis from Semistrutured Data John N. Wilson Rihard Gourlay Robert Japp Mathias Neumüller Department of Computer and Information Sienes University of Strathlyde, Glasgow, UK {jnw,rsg,rpj,mathias}@is.strath.a.uk

More information

Evaluation of Relational Operations: Other Techniques

Evaluation of Relational Operations: Other Techniques Evaluation of Relational Operations: Other Techniques Chapter 14, Part B Database Management Systems 3ed, R. Ramakrishnan and Johannes Gehrke 1 Using an Index for Selections Cost depends on #qualifying

More information

Incremental Mining of Partial Periodic Patterns in Time-series Databases

Incremental Mining of Partial Periodic Patterns in Time-series Databases CERIAS Teh Report 2000-03 Inremental Mining of Partial Periodi Patterns in Time-series Dataases Mohamed G. Elfeky Center for Eduation and Researh in Information Assurane and Seurity Purdue University,

More information

Dynamic Programming. Lecture #8 of Algorithms, Data structures and Complexity. Joost-Pieter Katoen Formal Methods and Tools Group

Dynamic Programming. Lecture #8 of Algorithms, Data structures and Complexity. Joost-Pieter Katoen Formal Methods and Tools Group Dynami Programming Leture #8 of Algorithms, Data strutures and Complexity Joost-Pieter Katoen Formal Methods and Tools Group E-mail: katoen@s.utwente.nl Otober 29, 2002 JPK #8: Dynami Programming ADC (214020)

More information

Relational Algebra. Note: Slides are posted on the class website, protected by a password written on the board

Relational Algebra. Note: Slides are posted on the class website, protected by a password written on the board Note: Slides are posted on the class website, protected by a password written on the board Reading: see class home page www.cs.umb.edu/cs630. Relational Algebra CS430/630 Lecture 2 Slides based on Database

More information

Implementation of Relational Operations: Other Operations

Implementation of Relational Operations: Other Operations Implementation of Relational Operations: Other Operations Module 4, Lecture 2 Database Management Systems, R. Ramakrishnan 1 Simple Selections SELECT * FROM Reserves R WHERE R.rname < C% Of the form σ

More information

Evaluation of Relational Operations: Other Techniques

Evaluation of Relational Operations: Other Techniques Evaluation of Relational Operations: Other Techniques [R&G] Chapter 14, Part B CS4320 1 Using an Index for Selections Cost depends on #qualifying tuples, and clustering. Cost of finding qualifying data

More information

Algorithms, Mechanisms and Procedures for the Computer-aided Project Generation System

Algorithms, Mechanisms and Procedures for the Computer-aided Project Generation System Algorithms, Mehanisms and Proedures for the Computer-aided Projet Generation System Anton O. Butko 1*, Aleksandr P. Briukhovetskii 2, Dmitry E. Grigoriev 2# and Konstantin S. Kalashnikov 3 1 Department

More information

Basic form of SQL Queries

Basic form of SQL Queries SQL - 1 Week 6 Basic form of SQL Queries SELECT FROM WHERE target-list relation-list qualification target-list A list of attributes of output relations in relation-list relation-list A list of relation

More information

Database Applications (15-415)

Database Applications (15-415) Database Applications (15-415) DBMS Internals- Part VII Lecture 15, March 17, 2014 Mohammad Hammoud Today Last Session: DBMS Internals- Part VI Algorithms for Relational Operations Today s Session: DBMS

More information

Copyright 2016 Ramez Elmasri and Shamkant B. Navathe

Copyright 2016 Ramez Elmasri and Shamkant B. Navathe CHAPTER 19 Query Optimization Introduction Query optimization Conducted by a query optimizer in a DBMS Goal: select best available strategy for executing query Based on information available Most RDBMSs

More information

Outline: Software Design

Outline: Software Design Outline: Software Design. Goals History of software design ideas Design priniples Design methods Life belt or leg iron? (Budgen) Copyright Nany Leveson, Sept. 1999 A Little History... At first, struggling

More information

Query Optimization. Query Optimization. Optimization considerations. Example. Interaction of algorithm choice and tree arrangement.

Query Optimization. Query Optimization. Optimization considerations. Example. Interaction of algorithm choice and tree arrangement. COS 597: Principles of Database and Information Systems Query Optimization Query Optimization Query as expression over relational algebraic operations Get evaluation (parse) tree Leaves: base relations

More information

SQL: Queries, Constraints, Triggers

SQL: Queries, Constraints, Triggers SQL: Queries, Constraints, Triggers [R&G] Chapter 5 CS4320 1 Example Instances We will use these instances of the Sailors and Reserves relations in our examples. If the key for the Reserves relation contained

More information

Chapter 13: Query Optimization. Chapter 13: Query Optimization

Chapter 13: Query Optimization. Chapter 13: Query Optimization Chapter 13: Query Optimization Database System Concepts, 6 th Ed. See www.db-book.com for conditions on re-use Chapter 13: Query Optimization Introduction Equivalent Relational Algebra Expressions Statistical

More information

Relational Query Languages. Preliminaries. Formal Relational Query Languages. Example Schema, with table contents. Relational Algebra

Relational Query Languages. Preliminaries. Formal Relational Query Languages. Example Schema, with table contents. Relational Algebra Note: Slides are posted on the class website, protected by a password written on the board Reading: see class home page www.cs.umb.edu/cs630. Relational Algebra CS430/630 Lecture 2 Relational Query Languages

More information

Contents Contents Introduction Basic Steps in Query Processing Introduction Transformation of Relational Expressions...

Contents Contents Introduction Basic Steps in Query Processing Introduction Transformation of Relational Expressions... Contents Contents...283 Introduction...283 Basic Steps in Query Processing...284 Introduction...285 Transformation of Relational Expressions...287 Equivalence Rules...289 Transformation Example: Pushing

More information