CSE 232A Graduate Database Systems

Size: px
Start display at page:

Download "CSE 232A Graduate Database Systems"

Transcription

1 CSE 232A Graduate Database Systems Arun Kumar Topic 4: Query Optimization Chapters 12 and 15 of Cow Book Slide ACKs: Jignesh Patel, Paris Koutris 1

2 Lifecycle of a Query Query Result Query Database Server Select R.text from Report R, Weather W where W.image.rain() and W.city = R.city and W.date = R.date and R.text. matches( insurance claims ) Query Parser Optimizer Syntax Tree and Logical Query Plan Physical Query Plan Query Scheduler Segments Execute Operators Query.... Result 2

3 Recall the Netflix Schema Ratings RatingID Stars RateDate UID MID /27/ UID Name Age JoinDate 79 Alice 23 01/10/13 80 Bob 41 05/10/13 Users MID Name Year Director Movies 20 Inception 2010 Christopher Nolan 16 Avatar 2009 Jim Cameron 3

4 Example SQL Query RatingID Stars RateDate UID MID UID Name Age JoinDate MID Name Year Director SELECT FROM WHERE M.Year, COUNT(*) AS NumBest Ratings R, Movies M R.MID = M.MID AND R.Stars = 5 GROUP BY M.Year ORDER BY NumBest DESC Suppose, we also have a B+Tree Index on Ratings (Stars) 4

5 Result Table Logical Query Plan SORT On NumBest GROUP BY AGGREGATE M.Year, COUNT(*) JOIN R.MID = M.MID Called Logical Operators From extended RA Each one has alternate physical implementations SELECT R.stars = 5 SELECT No predicate Ratings Table Movies Table 5

6 Result Table Physical Query Plan External Merge-Sort In-mem quicksort; B=50 Sort-based Aggregate Index-Nested Loop Join Called Physical Operators Specifies exact algorithm/code to run for each logical operator, with all parameters (if any) Indexed Access Use Index on Stars File Scan Read heapfile Aka Query Evaluation Plan Ratings Table Movies Table 6

7 Result Table Physical Query Plan External Merge-Sort In-mem quicksort; B=50 Hash-based Aggregate Hash Join This is also a correct PQP for the given LQP! Q: Which PQP is faster? This is a key job of the RDBMS Query Optimizer! File Scan Read Index leaf pages File Scan Read heapfile Ratings Table Movies Table 7

8 So, what is query optimization and how does it work? 8

9 Meet Query Optimization Basic Idea: Goal (Ideal): A given LQP could have several possible PQPs with very different runtime performance Get the optimal (fastest) PQP for a given LQP Goal (Realistic): Fine, just avoid the clearly awful PQPs! Jeff Naughton Query optimization is a metaphor for life itself! It is often hard to even know what an optimal plan would be, but it is feasible to avoid many obviously bad plans! 9

10 Query Optimization Overview of Query Optimizer Physical Query Plan (PQP) Concept: Pipelining Mechanism: Iterator Interface Enumerating Alternative PQPs Logical: Algebraic Rewrites Physical: Choosing Phy. Op. Impl. Costing PQPs Materialized Views 10

11 Overview of Query Optimizer SQL Query Logical Query Plan Parser Plan Enumerator Optimizer Plan Cost Estimator Catalog Physical Query Plan (Optimized) To Scheduler/Executor 11

12 System Catalog Set of pre-defined relations for metadata about DB (schema) For each Relation: Relation name, File name File structure (heap file vs. clustered B+ tree, etc.) Attribute names and types; Integrity constraints; Indexes For each Index: Index name, Structure (B+ tree vs. hash, etc.); Index key For each View: View name, and View definition 12

13 Statistics in the System Catalog RDBMS periodically collects stats about DB (instance) For each Table R: Cardinality, i.e., number of tuples, NTuples (R) Size, i.e., number of pages, NPages (R), or just N R For each Index X: Cardinality, i.e., number of distinct keys IKeys (X) Size, i.e., number of pages IPages (X) (for a B+ tree, this is the number of leaf pages only) Height (for tree indexes) IHeight (X) Min and max keys in index ILow (X), IHigh (X) 13

14 Query Optimization Overview of Query Optimizer Physical Query Plan (PQP) Concept: Pipelining Mechanism: Iterator Interface Enumerating Alternative PQPs Logical: Algebraic Rewrites Physical: Choosing Phy. Op. Impl. Costing PQPs Materialized Views 14

15 Result Table Concept: Pipelining External Merge-Sort In-mem quicksort; B=50 Hash-based Aggregate Q: Does the hash-based aggregate have to wait till the entire output of the upstream hash join is available? File Scan Read Index leaf pages Movies Table Hash Join File Scan Read heapfile RatingsTable No! We can pipeline the output of the join pass on a join output tuple as soon as it is obtained! 15

16 Concept: Pipelining Basic Idea: Benefits: Do not force downstream physical operators to wait till the entire output is available Display output to the user incrementally CPU Parallelism in multi-core systems! File Scan Tuples Hash Join Hash-based Aggregate 16

17 Concept: Pipelining Crucial for PQPs with workflow of many phy. ops. Common feature of almost all RDBMSs Works for many operators: SCAN, HASH JOIN, etc. Q: Are all physical operators amenable to pipelining? No! Some may stall the pipeline: Blocking Op A blocking op. requires its output to be Materialized as a temporary table Usually, any phy. op. involving sorting is blocking! 17

18 Result Table Blocking Op External Merge-Sort In-mem quicksort; B=50 Hash-based Aggregate Sort-Merge Join This phy. op. is blocking because we need to sort Movies and sort Ratings (materialize the output) before we can start any aggregate computations! File Scan Read heapfile File Scan Read heapfile Movies Table RatingsTable 18

19 Query Optimization Overview of Query Optimizer Physical Query Plan (PQP) Concept: Pipelining Mechanism: Iterator Interface Enumerating Alternative PQPs Logical: Algebraic Rewrites Physical: Choosing Phy. Op. Impl. Costing PQPs Materialized Views 19

20 Mechanism: Iterator Interface Software API to process PQP; makes pipelining easy to impl. Enables us to abstract away individual phy. op. impl. details Three main functions in usage interface of each phy. op.: Open(): GetNext(): Close(): Initialize the phy. op. state, get arguments Allocate input and output buffers Ask the phy. op. impl. to deliver next output tuple; pass it on; if blocking, wait Clear phy. op. state, free up space 20

21 Query Optimization Overview of Query Optimizer Physical Query Plan (PQP) Concept: Pipelining Mechanism: Iterator Interface Enumerating Alternative PQPs Logical: Algebraic Rewrites Physical: Choosing Phy. Op. Impl. Costing PQPs Materialized Views 21

22 Overview of Query Optimizer SQL Query Logical Query Plan Parser Plan Enumerator Optimizer Plan Cost Estimator Catalog Physical Query Plan (Optimized) To Scheduler/Executor 22

23 Enumerating Alternative PQPs Plan Enumerator explores various PQPs for a given LQP Challenge: Space of plans is huge! How to make it feasible? RDBMS Plan Enumerator has Rules to help determine what plans to enumerate, and also consults Cost models Two main sources of Rules for enumerating plans: Logical: Algebraic Rewrites: Use relational algebra equivalence to rewrite LQP itself! Physical: Choosing Phy. Op. Impl.: Use different phy. op. impl. for a given log. op. in LQP 23

24 Query Optimization Overview of Query Optimizer Physical Query Plan (PQP) Concept: Pipelining Mechanism: Iterator Interface Enumerating Alternative PQPs Logical: Algebraic Rewrites Physical: Choosing Phy. Op. Impl. Costing PQPs Materialized Views 24

25 Algebraic Rewrite Rules Rewrite a given RA query in to another that is equivalent (a logical property) but might be faster (a physical property) RA operators have some formal properties we can exploit We will cover only a few rewrite rules: Single-operator Rewrites Unary operators Binary operators Cross-operator Rewrites 25

26 Unary Operator Rewrites Key unary operators in RA: Commutativity of p 1 ( p2 (R)) = p2 ( p1 (R)) Cascading of p 1 ( p2 (... p n (R)...)) = p1^p 2^ ^p n (R) Cascading of A i A i+1 8i =1...(n 1) A1 ( A2 (... An (R)...)) = A1 (R) Q: Why are cascading rewrites beneficial? 26

27 Binary Operator Rewrites Key binary operator in RA: Commutativity of Associativity of././ R./ S = S./ R./ (R./ S)./ T = R./ (S./ T ) Q: Why are these properties beneficial? Q: What other binary operators in RA satisfy these? 27

28 Cross-Operator Rewrites Commuting and A B p(a)( B (R)) = B ( p(a) (R)) Combining and Pushing the select./ Commuting with and p(r S) =R./ p S p(a)(r./ S) = p(a)(r S) = p(a) (R)./ S p(a) (R) S A R. A (R S) = A\R. (R) A\S. (S) B A A (R./ p(b) S)= A\R. (R)./ p(b) A\S. (S) 28

29 Review Question 29

30 Query Optimization Overview of Query Optimizer Physical Query Plan (PQP) Concept: Pipelining Mechanism: Iterator Interface Enumerating Alternative PQPs Logical: Algebraic Rewrites Physical: Choosing Phy. Op. Impl. Costing PQPs Materialized Views 30

31 Choosing Phy. Op. Impl. Given a (rewritten) LQP, pick phy. op. impl. for each log. op. Recall various RA op. impl. with their I/O (and CPU costs)./ File scan vs Indexed (B+ Tree vs Hash) Hashing-based vs Sorting-based vs Indexed BNLJ vs INLJ vs SMJ vs HJ etc. Q: With algebraic rewrites?! 3 options 3 options 4 options = 36 PQPs! 31

32 Phy. Op. Impl.: Other Factors Are the indexes clustered or unclustered? Are there multiple matching indexes? Use multiple? Are index-only access paths possible for some ops? Are there interesting orderings among the inputs? Would sorted outputs benefit downstream ops? Estimation of cardinality of intermediate results! How best to reorder multi-table joins? Query optimizers are complex beasts! Still a hard, open research problem! 32

33 Phy. Op. Impl.: Join Orderings Since joins are associative, exponential number of orderings! Left Deep tree Right Deep tree Bushy tree Almost all RDBMSs consider only left deep join trees Enables easy pipelining! Why? Interesting orderings idea from System R optimizer paper Dynamic program to combine enumeration and costing Access Path Selection in a Relational Database Management System SIGMOD 79 33

34 Query Optimization Overview of Query Optimizer Physical Query Plan (PQP) Concept: Pipelining Mechanism: Iterator Interface Enumerating Alternative PQPs Logical: Algebraic Rewrites Physical: Choosing Phy. Op. Impl. Costing PQPs Materialized Views 34

35 Overview of Query Optimizer SQL Query Logical Query Plan Parser Plan Enumerator Optimizer Plan Cost Estimator Catalog Physical Query Plan (Optimized) To Scheduler/Executor 35

36 Costing PQPs For each PQP considered by the Plan Enumerator, the Plan Cost Estimator computes Cost of the PQP Weighted sum of I/O cost and CPU cost (Distributed RDBMSs also include Network cost) Challenge: Given a PQP, compute overall cost Issues to consider: Pipelining vs. blocking ops; cannot simply add costs! Cardinality estimation for intermediate tables! Q: What statistics does the catalog have to help? 36

37 Costing PQPs Most RDBMSs use various heuristics to make costing tractable; so, it is approximate! Example: Complex predicates Not enough info! But, most RDBMSs use the independence heuristic! Selectivity of conjunction = Product of selectivities Thus, 0.05 * 0.1 = 0.005, i.e., 0.5% 37

38 Query Optimization: Summary Plan Enumerator and Cost Estimator work in lock step: Rules determine what PQPs are enumerated Logical: Algebraic rewrites of LQP Physical: Op. Impl. and ordering alternatives Cost models and heuristics help cost the PQPs Still an active research area! Parametric Q.O., Multi-objective Q.O., Multi-objective parametric Q.O., Multiple Q.O., Online/Adaptive Q.O., Dynamic re-optimization, etc. 38

39 Review Question RatingID Stars RateDate UID MID 10m pages Page size 8KB; Buffer memory 4GB; 8B for each field SELECT COUNT(DISTINCT UID) FROM Ratings Propose an efficient physical plan and compute its I/O cost. Q: What if there was an unclustered B+ tree index on UID? (RecordID pointers can be assumed to be 8B too) 39

40 Review Question RatingID Stars RateDate UID MID MID Name Year Director Page size 8KB; Buffer memory 4GB 10m pages 100k pages SELECT AVG(Stars) FROM Ratings R, Movies M WHERE R.MID = M.MID AND M.Director = Christopher Nolan AND R.UID = 1234; Propose an efficient physical plan that does not materialize any intermediate data (fully pipelined) and compute its I/O cost. 40

41 Query Optimization Overview of Query Optimizer Physical Query Plan (PQP) Concept: Pipelining Mechanism: Iterator Interface Enumerating Alternative PQPs Logical: Algebraic Rewrites Physical: Choosing Phy. Op. Impl. Costing PQPs Materialized Views 41

42 <latexit sha1_base64="4hc4knyhfktkx2fu4hrzurw2dfy=">aaacexicbvfnbxmxepuuxyv8niujheyjog2hardfkgeqckwcc6h8jk2ujdjzz7kxaq9x9iwowi2/gd/gjt/chqtomkjqmjkl5zdvpom3wamkozj+gyrxrl67fmpjzuvw7tt3n9tb9/rovfzgtxhl7gkgdpusseesfj6wfkfnck+y86n5/uqlwidn8zlmjq415iwcsahkqvh7e5qd1jbkndbuuv2y/yb6rgbdt+hrr55m5itj5kmtuvfvk9lravgqsc2ls7mvdzs1fl5tttf+e28ufm12e73rrr2xf/nu+euqy44nf873y9+w1+2o2p14n14exwfjentymo5h7r/p2ihky0fcgxodjc5pwimlkrq2rbrywii4hxwhhhag0q3rhxmn3/hmme+m9acgvmd/rqhbozftmvfox3wxc3pyf7lbrznnw1owzuvyiitgk0pxmny+bj5egkhmhocw0s/kxrqscpllanktkstfxgf9vd3e4w9po4evlnzssadsm0usyqfskl1lx6zhbpsvpax2gsfb7/brgivplqrhsky5z/6jcp8pbkk/yg==</latexit> <latexit sha1_base64="4hc4knyhfktkx2fu4hrzurw2dfy=">aaacexicbvfnbxmxepuuxyv8niujheyjog2hardfkgeqckwcc6h8jk2ujdjzz7kxaq9x9iwowi2/gd/gjt/chqtomkjqmjkl5zdvpom3wamkozj+gyrxrl67fmpjzuvw7tt3n9tb9/rovfzgtxhl7gkgdpusseesfj6wfkfnck+y86n5/uqlwidn8zlmjq415iwcsahkqvh7e5qd1jbkndbuuv2y/yb6rgbdt+hrr55m5itj5kmtuvfvk9lravgqsc2ls7mvdzs1fl5tttf+e28ufm12e73rrr2xf/nu+euqy44nf873y9+w1+2o2p14n14exwfjentymo5h7r/p2ihky0fcgxodjc5pwimlkrq2rbrywii4hxwhhhag0q3rhxmn3/hmme+m9acgvmd/rqhbozftmvfox3wxc3pyf7lbrznnw1owzuvyiitgk0pxmny+bj5egkhmhocw0s/kxrqscpllanktkstfxgf9vd3e4w9po4evlnzssadsm0usyqfskl1lx6zhbpsvpax2gsfb7/brgivplqrhsky5z/6jcp8pbkk/yg==</latexit> <latexit sha1_base64="4hc4knyhfktkx2fu4hrzurw2dfy=">aaacexicbvfnbxmxepuuxyv8niujheyjog2hardfkgeqckwcc6h8jk2ujdjzz7kxaq9x9iwowi2/gd/gjt/chqtomkjqmjkl5zdvpom3wamkozj+gyrxrl67fmpjzuvw7tt3n9tb9/rovfzgtxhl7gkgdpusseesfj6wfkfnck+y86n5/uqlwidn8zlmjq415iwcsahkqvh7e5qd1jbkndbuuv2y/yb6rgbdt+hrr55m5itj5kmtuvfvk9lravgqsc2ls7mvdzs1fl5tttf+e28ufm12e73rrr2xf/nu+euqy44nf873y9+w1+2o2p14n14exwfjentymo5h7r/p2ihky0fcgxodjc5pwimlkrq2rbrywii4hxwhhhag0q3rhxmn3/hmme+m9acgvmd/rqhbozftmvfox3wxc3pyf7lbrznnw1owzuvyiitgk0pxmny+bj5egkhmhocw0s/kxrqscpllanktkstfxgf9vd3e4w9po4evlnzssadsm0usyqfskl1lx6zhbpsvpax2gsfb7/brgivplqrhsky5z/6jcp8pbkk/yg==</latexit> <latexit sha1_base64="4hc4knyhfktkx2fu4hrzurw2dfy=">aaacexicbvfnbxmxepuuxyv8niujheyjog2hardfkgeqckwcc6h8jk2ujdjzz7kxaq9x9iwowi2/gd/gjt/chqtomkjqmjkl5zdvpom3wamkozj+gyrxrl67fmpjzuvw7tt3n9tb9/rovfzgtxhl7gkgdpusseesfj6wfkfnck+y86n5/uqlwidn8zlmjq415iwcsahkqvh7e5qd1jbkndbuuv2y/yb6rgbdt+hrr55m5itj5kmtuvfvk9lravgqsc2ls7mvdzs1fl5tttf+e28ufm12e73rrr2xf/nu+euqy44nf873y9+w1+2o2p14n14exwfjentymo5h7r/p2ihky0fcgxodjc5pwimlkrq2rbrywii4hxwhhhag0q3rhxmn3/hmme+m9acgvmd/rqhbozftmvfox3wxc3pyf7lbrznnw1owzuvyiitgk0pxmny+bj5egkhmhocw0s/kxrqscpllanktkstfxgf9vd3e4w9po4evlnzssadsm0usyqfskl1lx6zhbpsvpax2gsfb7/brgivplqrhsky5z/6jcp8pbkk/yg==</latexit> Introducing Materialized Views A View is a virtual table created with an SQL query A Materialized View is a physically instantiated/stored view Example: RatingID Stars RateDate UID MID UID Name Age JoinDate MID Name Year Director SELECT AVG(Stars) FROM Ratings R, Movies M, Users U WHERE R.MID = M.MID AND R.UID = U.UID M.Director = Christopher Nolan AND U.Age >= 20 AND U.Age < 30; AVG (Stars)(R./ Director= Christopher Nolan (M)./ 20appleAge<30 (U)) Requires file scans of R, M, and U and, say, hash joins 42

43 <latexit sha1_base64="4hc4knyhfktkx2fu4hrzurw2dfy=">aaacexicbvfnbxmxepuuxyv8niujheyjog2hardfkgeqckwcc6h8jk2ujdjzz7kxaq9x9iwowi2/gd/gjt/chqtomkjqmjkl5zdvpom3wamkozj+gyrxrl67fmpjzuvw7tt3n9tb9/rovfzgtxhl7gkgdpusseesfj6wfkfnck+y86n5/uqlwidn8zlmjq415iwcsahkqvh7e5qd1jbkndbuuv2y/yb6rgbdt+hrr55m5itj5kmtuvfvk9lravgqsc2ls7mvdzs1fl5tttf+e28ufm12e73rrr2xf/nu+euqy44nf873y9+w1+2o2p14n14exwfjentymo5h7r/p2ihky0fcgxodjc5pwimlkrq2rbrywii4hxwhhhag0q3rhxmn3/hmme+m9acgvmd/rqhbozftmvfox3wxc3pyf7lbrznnw1owzuvyiitgk0pxmny+bj5egkhmhocw0s/kxrqscpllanktkstfxgf9vd3e4w9po4evlnzssadsm0usyqfskl1lx6zhbpsvpax2gsfb7/brgivplqrhsky5z/6jcp8pbkk/yg==</latexit> <latexit sha1_base64="4hc4knyhfktkx2fu4hrzurw2dfy=">aaacexicbvfnbxmxepuuxyv8niujheyjog2hardfkgeqckwcc6h8jk2ujdjzz7kxaq9x9iwowi2/gd/gjt/chqtomkjqmjkl5zdvpom3wamkozj+gyrxrl67fmpjzuvw7tt3n9tb9/rovfzgtxhl7gkgdpusseesfj6wfkfnck+y86n5/uqlwidn8zlmjq415iwcsahkqvh7e5qd1jbkndbuuv2y/yb6rgbdt+hrr55m5itj5kmtuvfvk9lravgqsc2ls7mvdzs1fl5tttf+e28ufm12e73rrr2xf/nu+euqy44nf873y9+w1+2o2p14n14exwfjentymo5h7r/p2ihky0fcgxodjc5pwimlkrq2rbrywii4hxwhhhag0q3rhxmn3/hmme+m9acgvmd/rqhbozftmvfox3wxc3pyf7lbrznnw1owzuvyiitgk0pxmny+bj5egkhmhocw0s/kxrqscpllanktkstfxgf9vd3e4w9po4evlnzssadsm0usyqfskl1lx6zhbpsvpax2gsfb7/brgivplqrhsky5z/6jcp8pbkk/yg==</latexit> <latexit sha1_base64="4hc4knyhfktkx2fu4hrzurw2dfy=">aaacexicbvfnbxmxepuuxyv8niujheyjog2hardfkgeqckwcc6h8jk2ujdjzz7kxaq9x9iwowi2/gd/gjt/chqtomkjqmjkl5zdvpom3wamkozj+gyrxrl67fmpjzuvw7tt3n9tb9/rovfzgtxhl7gkgdpusseesfj6wfkfnck+y86n5/uqlwidn8zlmjq415iwcsahkqvh7e5qd1jbkndbuuv2y/yb6rgbdt+hrr55m5itj5kmtuvfvk9lravgqsc2ls7mvdzs1fl5tttf+e28ufm12e73rrr2xf/nu+euqy44nf873y9+w1+2o2p14n14exwfjentymo5h7r/p2ihky0fcgxodjc5pwimlkrq2rbrywii4hxwhhhag0q3rhxmn3/hmme+m9acgvmd/rqhbozftmvfox3wxc3pyf7lbrznnw1owzuvyiitgk0pxmny+bj5egkhmhocw0s/kxrqscpllanktkstfxgf9vd3e4w9po4evlnzssadsm0usyqfskl1lx6zhbpsvpax2gsfb7/brgivplqrhsky5z/6jcp8pbkk/yg==</latexit> <latexit sha1_base64="4hc4knyhfktkx2fu4hrzurw2dfy=">aaacexicbvfnbxmxepuuxyv8niujheyjog2hardfkgeqckwcc6h8jk2ujdjzz7kxaq9x9iwowi2/gd/gjt/chqtomkjqmjkl5zdvpom3wamkozj+gyrxrl67fmpjzuvw7tt3n9tb9/rovfzgtxhl7gkgdpusseesfj6wfkfnck+y86n5/uqlwidn8zlmjq415iwcsahkqvh7e5qd1jbkndbuuv2y/yb6rgbdt+hrr55m5itj5kmtuvfvk9lravgqsc2ls7mvdzs1fl5tttf+e28ufm12e73rrr2xf/nu+euqy44nf873y9+w1+2o2p14n14exwfjentymo5h7r/p2ihky0fcgxodjc5pwimlkrq2rbrywii4hxwhhhag0q3rhxmn3/hmme+m9acgvmd/rqhbozftmvfox3wxc3pyf7lbrznnw1owzuvyiitgk0pxmny+bj5egkhmhocw0s/kxrqscpllanktkstfxgf9vd3e4w9po4evlnzssadsm0usyqfskl1lx6zhbpsvpax2gsfb7/brgivplqrhsky5z/6jcp8pbkk/yg==</latexit> <latexit sha1_base64="g7fjnxzvcmjeorqmazkc0to5ksk=">aaacznicbzhbaxnbfmzn16pt1da2iidehgyhhvj2rdclunoc7kfsq0kl2zc+nbxnhs7oldnvw8ky/phephvxz3a2jaitdwz+fn97zjtv0kjjr1h0pqgfrdx89hh1rfxk6bp1jfbzzyezprxyf0yze5gcqyu19kmswovciuspwvp06qjxz6/romn0f5oxomphqmumbzcxxu16wbofgyg15oynhrxxsq40k1sd+ry9pe7t8c/ednu83/djca+uefemj6m5iyk8cxkaw5+xnrqoynj6/exlb+1ozv1ttdfd+/wjuadrnbp7srs7bnei/whr/d7es+iwzz2o29+sirfljpqeauegcvtqqajluiisw0npsabxbvmcetsqoxtvi5hq/sore54z648mvld/nqggd26ep76z2dvd9rrxf96wpozdqjk6kam1ul0okxunw5vm+wqrizp7aggl35wlgvgq5h+m5uoi7z75pgxe78eep73phbwu41hl22yhdvnm3rid9ogdsj4t7eewfmwgw8hpcd18eb68bq2d5cww+6dc/gvzi7i/</latexit> <latexit sha1_base64="g7fjnxzvcmjeorqmazkc0to5ksk=">aaacznicbzhbaxnbfmzn16pt1da2iidehgyhhvj2rdclunoc7kfsq0kl2zc+nbxnhs7oldnvw8ky/phephvxz3a2jaitdwz+fn97zjtv0kjjr1h0pqgfrdx89hh1rfxk6bp1jfbzzyezprxyf0yze5gcqyu19kmswovciuspwvp06qjxz6/romn0f5oxomphqmumbzcxxu16wbofgyg15oynhrxxsq40k1sd+ry9pe7t8c/ednu83/djca+uefemj6m5iyk8cxkaw5+xnrqoynj6/exlb+1ozv1ttdfd+/wjuadrnbp7srs7bnei/whr/d7es+iwzz2o29+sirfljpqeauegcvtqqajluiisw0npsabxbvmcetsqoxtvi5hq/sore54z648mvld/nqggd26ep76z2dvd9rrxf96wpozdqjk6kam1ul0okxunw5vm+wqrizp7aggl35wlgvgq5h+m5uoi7z75pgxe78eep73phbwu41hl22yhdvnm3rid9ogdsj4t7eewfmwgw8hpcd18eb68bq2d5cww+6dc/gvzi7i/</latexit> <latexit sha1_base64="g7fjnxzvcmjeorqmazkc0to5ksk=">aaacznicbzhbaxnbfmzn16pt1da2iidehgyhhvj2rdclunoc7kfsq0kl2zc+nbxnhs7oldnvw8ky/phephvxz3a2jaitdwz+fn97zjtv0kjjr1h0pqgfrdx89hh1rfxk6bp1jfbzzyezprxyf0yze5gcqyu19kmswovciuspwvp06qjxz6/romn0f5oxomphqmumbzcxxu16wbofgyg15oynhrxxsq40k1sd+ry9pe7t8c/ednu83/djca+uefemj6m5iyk8cxkaw5+xnrqoynj6/exlb+1ozv1ttdfd+/wjuadrnbp7srs7bnei/whr/d7es+iwzz2o29+sirfljpqeauegcvtqqajluiisw0npsabxbvmcetsqoxtvi5hq/sore54z648mvld/nqggd26ep76z2dvd9rrxf96wpozdqjk6kam1ul0okxunw5vm+wqrizp7aggl35wlgvgq5h+m5uoi7z75pgxe78eep73phbwu41hl22yhdvnm3rid9ogdsj4t7eewfmwgw8hpcd18eb68bq2d5cww+6dc/gvzi7i/</latexit> <latexit sha1_base64="g7fjnxzvcmjeorqmazkc0to5ksk=">aaacznicbzhbaxnbfmzn16pt1da2iidehgyhhvj2rdclunoc7kfsq0kl2zc+nbxnhs7oldnvw8ky/phephvxz3a2jaitdwz+fn97zjtv0kjjr1h0pqgfrdx89hh1rfxk6bp1jfbzzyezprxyf0yze5gcqyu19kmswovciuspwvp06qjxz6/romn0f5oxomphqmumbzcxxu16wbofgyg15oynhrxxsq40k1sd+ry9pe7t8c/ednu83/djca+uefemj6m5iyk8cxkaw5+xnrqoynj6/exlb+1ozv1ttdfd+/wjuadrnbp7srs7bnei/whr/d7es+iwzz2o29+sirfljpqeauegcvtqqajluiisw0npsabxbvmcetsqoxtvi5hq/sore54z648mvld/nqggd26ep76z2dvd9rrxf96wpozdqjk6kam1ul0okxunw5vm+wqrizp7aggl35wlgvgq5h+m5uoi7z75pgxe78eep73phbwu41hl22yhdvnm3rid9ogdsj4t7eewfmwgw8hpcd18eb68bq2d5cww+6dc/gvzi7i/</latexit> Materialized Views Example Example: RatingID Stars RateDate UID MID UID Name Age JoinDate MID Name Year Director AVG (Stars)(R./ Director= Christopher Nolan (M)./ 20appleAge<30 (U)) CREATE MATERIALIZED VIEW NolanRatings AS SELECT RatingID, Stars, UID, MID FROM Ratings R, Movies M WHERE R.MID = M.MID AND M.Director = Christopher Nolan ; Creates a subset of R with ratings for only Nolan s movies V RatingID,Stars,UID,MID (R./ Director= Christopher Nolan (M)) 43

44 <latexit sha1_base64="4hc4knyhfktkx2fu4hrzurw2dfy=">aaacexicbvfnbxmxepuuxyv8niujheyjog2hardfkgeqckwcc6h8jk2ujdjzz7kxaq9x9iwowi2/gd/gjt/chqtomkjqmjkl5zdvpom3wamkozj+gyrxrl67fmpjzuvw7tt3n9tb9/rovfzgtxhl7gkgdpusseesfj6wfkfnck+y86n5/uqlwidn8zlmjq415iwcsahkqvh7e5qd1jbkndbuuv2y/yb6rgbdt+hrr55m5itj5kmtuvfvk9lravgqsc2ls7mvdzs1fl5tttf+e28ufm12e73rrr2xf/nu+euqy44nf873y9+w1+2o2p14n14exwfjentymo5h7r/p2ihky0fcgxodjc5pwimlkrq2rbrywii4hxwhhhag0q3rhxmn3/hmme+m9acgvmd/rqhbozftmvfox3wxc3pyf7lbrznnw1owzuvyiitgk0pxmny+bj5egkhmhocw0s/kxrqscpllanktkstfxgf9vd3e4w9po4evlnzssadsm0usyqfskl1lx6zhbpsvpax2gsfb7/brgivplqrhsky5z/6jcp8pbkk/yg==</latexit> <latexit sha1_base64="4hc4knyhfktkx2fu4hrzurw2dfy=">aaacexicbvfnbxmxepuuxyv8niujheyjog2hardfkgeqckwcc6h8jk2ujdjzz7kxaq9x9iwowi2/gd/gjt/chqtomkjqmjkl5zdvpom3wamkozj+gyrxrl67fmpjzuvw7tt3n9tb9/rovfzgtxhl7gkgdpusseesfj6wfkfnck+y86n5/uqlwidn8zlmjq415iwcsahkqvh7e5qd1jbkndbuuv2y/yb6rgbdt+hrr55m5itj5kmtuvfvk9lravgqsc2ls7mvdzs1fl5tttf+e28ufm12e73rrr2xf/nu+euqy44nf873y9+w1+2o2p14n14exwfjentymo5h7r/p2ihky0fcgxodjc5pwimlkrq2rbrywii4hxwhhhag0q3rhxmn3/hmme+m9acgvmd/rqhbozftmvfox3wxc3pyf7lbrznnw1owzuvyiitgk0pxmny+bj5egkhmhocw0s/kxrqscpllanktkstfxgf9vd3e4w9po4evlnzssadsm0usyqfskl1lx6zhbpsvpax2gsfb7/brgivplqrhsky5z/6jcp8pbkk/yg==</latexit> <latexit sha1_base64="4hc4knyhfktkx2fu4hrzurw2dfy=">aaacexicbvfnbxmxepuuxyv8niujheyjog2hardfkgeqckwcc6h8jk2ujdjzz7kxaq9x9iwowi2/gd/gjt/chqtomkjqmjkl5zdvpom3wamkozj+gyrxrl67fmpjzuvw7tt3n9tb9/rovfzgtxhl7gkgdpusseesfj6wfkfnck+y86n5/uqlwidn8zlmjq415iwcsahkqvh7e5qd1jbkndbuuv2y/yb6rgbdt+hrr55m5itj5kmtuvfvk9lravgqsc2ls7mvdzs1fl5tttf+e28ufm12e73rrr2xf/nu+euqy44nf873y9+w1+2o2p14n14exwfjentymo5h7r/p2ihky0fcgxodjc5pwimlkrq2rbrywii4hxwhhhag0q3rhxmn3/hmme+m9acgvmd/rqhbozftmvfox3wxc3pyf7lbrznnw1owzuvyiitgk0pxmny+bj5egkhmhocw0s/kxrqscpllanktkstfxgf9vd3e4w9po4evlnzssadsm0usyqfskl1lx6zhbpsvpax2gsfb7/brgivplqrhsky5z/6jcp8pbkk/yg==</latexit> <latexit sha1_base64="4hc4knyhfktkx2fu4hrzurw2dfy=">aaacexicbvfnbxmxepuuxyv8niujheyjog2hardfkgeqckwcc6h8jk2ujdjzz7kxaq9x9iwowi2/gd/gjt/chqtomkjqmjkl5zdvpom3wamkozj+gyrxrl67fmpjzuvw7tt3n9tb9/rovfzgtxhl7gkgdpusseesfj6wfkfnck+y86n5/uqlwidn8zlmjq415iwcsahkqvh7e5qd1jbkndbuuv2y/yb6rgbdt+hrr55m5itj5kmtuvfvk9lravgqsc2ls7mvdzs1fl5tttf+e28ufm12e73rrr2xf/nu+euqy44nf873y9+w1+2o2p14n14exwfjentymo5h7r/p2ihky0fcgxodjc5pwimlkrq2rbrywii4hxwhhhag0q3rhxmn3/hmme+m9acgvmd/rqhbozftmvfox3wxc3pyf7lbrznnw1owzuvyiitgk0pxmny+bj5egkhmhocw0s/kxrqscpllanktkstfxgf9vd3e4w9po4evlnzssadsm0usyqfskl1lx6zhbpsvpax2gsfb7/brgivplqrhsky5z/6jcp8pbkk/yg==</latexit> <latexit sha1_base64="g7fjnxzvcmjeorqmazkc0to5ksk=">aaacznicbzhbaxnbfmzn16pt1da2iidehgyhhvj2rdclunoc7kfsq0kl2zc+nbxnhs7oldnvw8ky/phephvxz3a2jaitdwz+fn97zjtv0kjjr1h0pqgfrdx89hh1rfxk6bp1jfbzzyezprxyf0yze5gcqyu19kmswovciuspwvp06qjxz6/romn0f5oxomphqmumbzcxxu16wbofgyg15oynhrxxsq40k1sd+ry9pe7t8c/ednu83/djca+uefemj6m5iyk8cxkaw5+xnrqoynj6/exlb+1ozv1ttdfd+/wjuadrnbp7srs7bnei/whr/d7es+iwzz2o29+sirfljpqeauegcvtqqajluiisw0npsabxbvmcetsqoxtvi5hq/sore54z648mvld/nqggd26ep76z2dvd9rrxf96wpozdqjk6kam1ul0okxunw5vm+wqrizp7aggl35wlgvgq5h+m5uoi7z75pgxe78eep73phbwu41hl22yhdvnm3rid9ogdsj4t7eewfmwgw8hpcd18eb68bq2d5cww+6dc/gvzi7i/</latexit> <latexit sha1_base64="g7fjnxzvcmjeorqmazkc0to5ksk=">aaacznicbzhbaxnbfmzn16pt1da2iidehgyhhvj2rdclunoc7kfsq0kl2zc+nbxnhs7oldnvw8ky/phephvxz3a2jaitdwz+fn97zjtv0kjjr1h0pqgfrdx89hh1rfxk6bp1jfbzzyezprxyf0yze5gcqyu19kmswovciuspwvp06qjxz6/romn0f5oxomphqmumbzcxxu16wbofgyg15oynhrxxsq40k1sd+ry9pe7t8c/ednu83/djca+uefemj6m5iyk8cxkaw5+xnrqoynj6/exlb+1ozv1ttdfd+/wjuadrnbp7srs7bnei/whr/d7es+iwzz2o29+sirfljpqeauegcvtqqajluiisw0npsabxbvmcetsqoxtvi5hq/sore54z648mvld/nqggd26ep76z2dvd9rrxf96wpozdqjk6kam1ul0okxunw5vm+wqrizp7aggl35wlgvgq5h+m5uoi7z75pgxe78eep73phbwu41hl22yhdvnm3rid9ogdsj4t7eewfmwgw8hpcd18eb68bq2d5cww+6dc/gvzi7i/</latexit> <latexit sha1_base64="g7fjnxzvcmjeorqmazkc0to5ksk=">aaacznicbzhbaxnbfmzn16pt1da2iidehgyhhvj2rdclunoc7kfsq0kl2zc+nbxnhs7oldnvw8ky/phephvxz3a2jaitdwz+fn97zjtv0kjjr1h0pqgfrdx89hh1rfxk6bp1jfbzzyezprxyf0yze5gcqyu19kmswovciuspwvp06qjxz6/romn0f5oxomphqmumbzcxxu16wbofgyg15oynhrxxsq40k1sd+ry9pe7t8c/ednu83/djca+uefemj6m5iyk8cxkaw5+xnrqoynj6/exlb+1ozv1ttdfd+/wjuadrnbp7srs7bnei/whr/d7es+iwzz2o29+sirfljpqeauegcvtqqajluiisw0npsabxbvmcetsqoxtvi5hq/sore54z648mvld/nqggd26ep76z2dvd9rrxf96wpozdqjk6kam1ul0okxunw5vm+wqrizp7aggl35wlgvgq5h+m5uoi7z75pgxe78eep73phbwu41hl22yhdvnm3rid9ogdsj4t7eewfmwgw8hpcd18eb68bq2d5cww+6dc/gvzi7i/</latexit> <latexit sha1_base64="g7fjnxzvcmjeorqmazkc0to5ksk=">aaacznicbzhbaxnbfmzn16pt1da2iidehgyhhvj2rdclunoc7kfsq0kl2zc+nbxnhs7oldnvw8ky/phephvxz3a2jaitdwz+fn97zjtv0kjjr1h0pqgfrdx89hh1rfxk6bp1jfbzzyezprxyf0yze5gcqyu19kmswovciuspwvp06qjxz6/romn0f5oxomphqmumbzcxxu16wbofgyg15oynhrxxsq40k1sd+ry9pe7t8c/ednu83/djca+uefemj6m5iyk8cxkaw5+xnrqoynj6/exlb+1ozv1ttdfd+/wjuadrnbp7srs7bnei/whr/d7es+iwzz2o29+sirfljpqeauegcvtqqajluiisw0npsabxbvmcetsqoxtvi5hq/sore54z648mvld/nqggd26ep76z2dvd9rrxf96wpozdqjk6kam1ul0okxunw5vm+wqrizp7aggl35wlgvgq5h+m5uoi7z75pgxe78eep73phbwu41hl22yhdvnm3rid9ogdsj4t7eewfmwgw8hpcd18eb68bq2d5cww+6dc/gvzi7i/</latexit> <latexit sha1_base64="zkjpkjwfaz7r6dtmfiabaesjtz0=">aaacnxicbva9txtben0jfjovjylpvlhidmpdavjsudhjkrquilbb8lnw3hp8xnn37rq7l8g6+u+lyf+ggoiicnhyf1gbi/h1pjxevnmjmxlrpqql37/y5j7mlywula+uvtfwnzblhz+1bjobgu2rqtscr2bryqsbjenhewyqdktwlbr+mntpfqoxmk1oazrhr0ocyl4uqe7qlg/dglsgbqibbpkkb62f1rmcy2tjxm3xmer/keqewhk7v7hr81c575m7xje/4hu+mzdrtw654tf9kfhbesxihc1w1c1fhl1u5botegqsbqd+rp0cdemhcfwkc4sziche2hy0ay22u0yvhvmdp/r4pzxujcsn6vooars1ix0552rd+7o2ed+rtxpqf+0umslywkq8durnilpkjxhynjqosi0cawgk25wlargq5iiuurcc1ye/ja3deud48x6l8x0wxzlbytusygl2htxyl3bemkywv+ys/wc33j/v2rv17h6tc96s5zn7ae/+adqxqyu=</latexit> <latexit sha1_base64="zkjpkjwfaz7r6dtmfiabaesjtz0=">aaacnxicbva9txtben0jfjovjylpvlhidmpdavjsudhjkrquilbb8lnw3hp8xnn37rq7l8g6+u+lyf+ggoiicnhyf1gbi/h1pjxevnmjmxlrpqql37/y5j7mlywula+uvtfwnzblhz+1bjobgu2rqtscr2bryqsbjenhewyqdktwlbr+mntpfqoxmk1oazrhr0ocyl4uqe7qlg/dglsgbqibbpkkb62f1rmcy2tjxm3xmer/keqewhk7v7hr81c575m7xje/4hu+mzdrtw654tf9kfhbesxihc1w1c1fhl1u5botegqsbqd+rp0cdemhcfwkc4sziche2hy0ay22u0yvhvmdp/r4pzxujcsn6vooars1ix0552rd+7o2ed+rtxpqf+0umslywkq8durnilpkjxhynjqosi0cawgk25wlargq5iiuurcc1ye/ja3deud48x6l8x0wxzlbytusygl2htxyl3bemkywv+ys/wc33j/v2rv17h6tc96s5zn7ae/+adqxqyu=</latexit> <latexit sha1_base64="zkjpkjwfaz7r6dtmfiabaesjtz0=">aaacnxicbva9txtben0jfjovjylpvlhidmpdavjsudhjkrquilbb8lnw3hp8xnn37rq7l8g6+u+lyf+ggoiicnhyf1gbi/h1pjxevnmjmxlrpqql37/y5j7mlywula+uvtfwnzblhz+1bjobgu2rqtscr2bryqsbjenhewyqdktwlbr+mntpfqoxmk1oazrhr0ocyl4uqe7qlg/dglsgbqibbpkkb62f1rmcy2tjxm3xmer/keqewhk7v7hr81c575m7xje/4hu+mzdrtw654tf9kfhbesxihc1w1c1fhl1u5botegqsbqd+rp0cdemhcfwkc4sziche2hy0ay22u0yvhvmdp/r4pzxujcsn6vooars1ix0552rd+7o2ed+rtxpqf+0umslywkq8durnilpkjxhynjqosi0cawgk25wlargq5iiuurcc1ye/ja3deud48x6l8x0wxzlbytusygl2htxyl3bemkywv+ys/wc33j/v2rv17h6tc96s5zn7ae/+adqxqyu=</latexit> <latexit sha1_base64="zkjpkjwfaz7r6dtmfiabaesjtz0=">aaacnxicbva9txtben0jfjovjylpvlhidmpdavjsudhjkrquilbb8lnw3hp8xnn37rq7l8g6+u+lyf+ggoiicnhyf1gbi/h1pjxevnmjmxlrpqql37/y5j7mlywula+uvtfwnzblhz+1bjobgu2rqtscr2bryqsbjenhewyqdktwlbr+mntpfqoxmk1oazrhr0ocyl4uqe7qlg/dglsgbqibbpkkb62f1rmcy2tjxm3xmer/keqewhk7v7hr81c575m7xje/4hu+mzdrtw654tf9kfhbesxihc1w1c1fhl1u5botegqsbqd+rp0cdemhcfwkc4sziche2hy0ay22u0yvhvmdp/r4pzxujcsn6vooars1ix0552rd+7o2ed+rtxpqf+0umslywkq8durnilpkjxhynjqosi0cawgk25wlargq5iiuurcc1ye/ja3deud48x6l8x0wxzlbytusygl2htxyl3bemkywv+ys/wc33j/v2rv17h6tc96s5zn7ae/+adqxqyu=</latexit> Materialized Views Example Example: RatingID Stars RateDate UID MID UID Name Age JoinDate MID Name Year Director AVG (Stars)(R./ Director= Christopher Nolan (M)./ 20appleAge<30 (U)) Given the materialized view V, RDBMS optimizer can automatically rewrite to use V to avoid scans of R and M V RatingID,Stars,UID,MID (R./ Director= Christopher Nolan (M)) AVG (Stars)(V./ 20appleAge<30 (U)) Likely much faster since V is likely much smaller than R, but this depends on data statistics; leave it to optimizer! Q: How did DBA know to materialize a view for Nolan ratings? 44

45 <latexit sha1_base64="g7fjnxzvcmjeorqmazkc0to5ksk=">aaacznicbzhbaxnbfmzn16pt1da2iidehgyhhvj2rdclunoc7kfsq0kl2zc+nbxnhs7oldnvw8ky/phephvxz3a2jaitdwz+fn97zjtv0kjjr1h0pqgfrdx89hh1rfxk6bp1jfbzzyezprxyf0yze5gcqyu19kmswovciuspwvp06qjxz6/romn0f5oxomphqmumbzcxxu16wbofgyg15oynhrxxsq40k1sd+ry9pe7t8c/ednu83/djca+uefemj6m5iyk8cxkaw5+xnrqoynj6/exlb+1ozv1ttdfd+/wjuadrnbp7srs7bnei/whr/d7es+iwzz2o29+sirfljpqeauegcvtqqajluiisw0npsabxbvmcetsqoxtvi5hq/sore54z648mvld/nqggd26ep76z2dvd9rrxf96wpozdqjk6kam1ul0okxunw5vm+wqrizp7aggl35wlgvgq5h+m5uoi7z75pgxe78eep73phbwu41hl22yhdvnm3rid9ogdsj4t7eewfmwgw8hpcd18eb68bq2d5cww+6dc/gvzi7i/</latexit> <latexit sha1_base64="g7fjnxzvcmjeorqmazkc0to5ksk=">aaacznicbzhbaxnbfmzn16pt1da2iidehgyhhvj2rdclunoc7kfsq0kl2zc+nbxnhs7oldnvw8ky/phephvxz3a2jaitdwz+fn97zjtv0kjjr1h0pqgfrdx89hh1rfxk6bp1jfbzzyezprxyf0yze5gcqyu19kmswovciuspwvp06qjxz6/romn0f5oxomphqmumbzcxxu16wbofgyg15oynhrxxsq40k1sd+ry9pe7t8c/ednu83/djca+uefemj6m5iyk8cxkaw5+xnrqoynj6/exlb+1ozv1ttdfd+/wjuadrnbp7srs7bnei/whr/d7es+iwzz2o29+sirfljpqeauegcvtqqajluiisw0npsabxbvmcetsqoxtvi5hq/sore54z648mvld/nqggd26ep76z2dvd9rrxf96wpozdqjk6kam1ul0okxunw5vm+wqrizp7aggl35wlgvgq5h+m5uoi7z75pgxe78eep73phbwu41hl22yhdvnm3rid9ogdsj4t7eewfmwgw8hpcd18eb68bq2d5cww+6dc/gvzi7i/</latexit> <latexit sha1_base64="g7fjnxzvcmjeorqmazkc0to5ksk=">aaacznicbzhbaxnbfmzn16pt1da2iidehgyhhvj2rdclunoc7kfsq0kl2zc+nbxnhs7oldnvw8ky/phephvxz3a2jaitdwz+fn97zjtv0kjjr1h0pqgfrdx89hh1rfxk6bp1jfbzzyezprxyf0yze5gcqyu19kmswovciuspwvp06qjxz6/romn0f5oxomphqmumbzcxxu16wbofgyg15oynhrxxsq40k1sd+ry9pe7t8c/ednu83/djca+uefemj6m5iyk8cxkaw5+xnrqoynj6/exlb+1ozv1ttdfd+/wjuadrnbp7srs7bnei/whr/d7es+iwzz2o29+sirfljpqeauegcvtqqajluiisw0npsabxbvmcetsqoxtvi5hq/sore54z648mvld/nqggd26ep76z2dvd9rrxf96wpozdqjk6kam1ul0okxunw5vm+wqrizp7aggl35wlgvgq5h+m5uoi7z75pgxe78eep73phbwu41hl22yhdvnm3rid9ogdsj4t7eewfmwgw8hpcd18eb68bq2d5cww+6dc/gvzi7i/</latexit> <latexit sha1_base64="g7fjnxzvcmjeorqmazkc0to5ksk=">aaacznicbzhbaxnbfmzn16pt1da2iidehgyhhvj2rdclunoc7kfsq0kl2zc+nbxnhs7oldnvw8ky/phephvxz3a2jaitdwz+fn97zjtv0kjjr1h0pqgfrdx89hh1rfxk6bp1jfbzzyezprxyf0yze5gcqyu19kmswovciuspwvp06qjxz6/romn0f5oxomphqmumbzcxxu16wbofgyg15oynhrxxsq40k1sd+ry9pe7t8c/ednu83/djca+uefemj6m5iyk8cxkaw5+xnrqoynj6/exlb+1ozv1ttdfd+/wjuadrnbp7srs7bnei/whr/d7es+iwzz2o29+sirfljpqeauegcvtqqajluiisw0npsabxbvmcetsqoxtvi5hq/sore54z648mvld/nqggd26ep76z2dvd9rrxf96wpozdqjk6kam1ul0okxunw5vm+wqrizp7aggl35wlgvgq5h+m5uoi7z75pgxe78eep73phbwu41hl22yhdvnm3rid9ogdsj4t7eewfmwgw8hpcd18eb68bq2d5cww+6dc/gvzi7i/</latexit> Materialized View Maintenance Example: RatingID Stars RateDate UID MID UID Name Age JoinDate MID Name Year Director We are given this materialized view V over R and M V RatingID,Stars,UID,MID (R./ Director= Christopher Nolan (M)) Q: What if new ratings are inserted to R for Nolan s movies? RDBMS will automatically trigger updates to V Such updates are called Materialized View Maintenance 2 alternatives: Recompute whole view from scratch vs Incremental View Maintenance (IVM) 45

46 <latexit sha1_base64="mddam1hjpkcdqhsi1agpf+zdvfa=">aaab73icbzbnswmxeizn/az1q+rrs7ai9vj2rdclunsdxxbsb7rlyabznjsbxznzozt+cs8efphq3/hmvzft96ctlwqe3pkhm2+qsghqdb+dldw19y3n3fz+e2d3b79wcngwcaozr7nyxrovumolulyoaivvjzrtkjc8gqxvp/xme9dgxoobrwn3i9pxihsmorvadxjnaqw7s26h6jbdmcgyebkuivo1w/jq9gkwrlwhk9sytucm6i+prsekn+q7qeejzupa522likbc+opzvhnyap0ecwntn0iyc39pjglkzcgkbgdecwawa1pzv1o7xfdkhwuvpmgvm38uppjgtkbhk57qnkecwabmc7sryqoqkumbud6g4c2evayn87jnuxzrrnxkcetgge6gbb5cqgxuoqp1ycdhgv7hzxl0xpx352peuujkm0fwr87nd9wkjom=</latexit> <latexit sha1_base64="mddam1hjpkcdqhsi1agpf+zdvfa=">aaab73icbzbnswmxeizn/az1q+rrs7ai9vj2rdclunsdxxbsb7rlyabznjsbxznzozt+cs8efphq3/hmvzft96ctlwqe3pkhm2+qsghqdb+dldw19y3n3fz+e2d3b79wcngwcaozr7nyxrovumolulyoaivvjzrtkjc8gqxvp/xme9dgxoobrwn3i9pxihsmorvadxjnaqw7s26h6jbdmcgyebkuivo1w/jq9gkwrlwhk9sytucm6i+prsekn+q7qeejzupa522likbc+opzvhnyap0ecwntn0iyc39pjglkzcgkbgdecwawa1pzv1o7xfdkhwuvpmgvm38uppjgtkbhk57qnkecwabmc7sryqoqkumbud6g4c2evayn87jnuxzrrnxkcetgge6gbb5cqgxuoqp1ycdhgv7hzxl0xpx352peuujkm0fwr87nd9wkjom=</latexit> <latexit sha1_base64="mddam1hjpkcdqhsi1agpf+zdvfa=">aaab73icbzbnswmxeizn/az1q+rrs7ai9vj2rdclunsdxxbsb7rlyabznjsbxznzozt+cs8efphq3/hmvzft96ctlwqe3pkhm2+qsghqdb+dldw19y3n3fz+e2d3b79wcngwcaozr7nyxrovumolulyoaivvjzrtkjc8gqxvp/xme9dgxoobrwn3i9pxihsmorvadxjnaqw7s26h6jbdmcgyebkuivo1w/jq9gkwrlwhk9sytucm6i+prsekn+q7qeejzupa522likbc+opzvhnyap0ecwntn0iyc39pjglkzcgkbgdecwawa1pzv1o7xfdkhwuvpmgvm38uppjgtkbhk57qnkecwabmc7sryqoqkumbud6g4c2evayn87jnuxzrrnxkcetgge6gbb5cqgxuoqp1ycdhgv7hzxl0xpx352peuujkm0fwr87nd9wkjom=</latexit> <latexit sha1_base64="mddam1hjpkcdqhsi1agpf+zdvfa=">aaab73icbzbnswmxeizn/az1q+rrs7ai9vj2rdclunsdxxbsb7rlyabznjsbxznzozt+cs8efphq3/hmvzft96ctlwqe3pkhm2+qsghqdb+dldw19y3n3fz+e2d3b79wcngwcaozr7nyxrovumolulyoaivvjzrtkjc8gqxvp/xme9dgxoobrwn3i9pxihsmorvadxjnaqw7s26h6jbdmcgyebkuivo1w/jq9gkwrlwhk9sytucm6i+prsekn+q7qeejzupa522likbc+opzvhnyap0ecwntn0iyc39pjglkzcgkbgdecwawa1pzv1o7xfdkhwuvpmgvm38uppjgtkbhk57qnkecwabmc7sryqoqkumbud6g4c2evayn87jnuxzrrnxkcetgge6gbb5cqgxuoqp1ycdhgv7hzxl0xpx352peuujkm0fwr87nd9wkjom=</latexit> <latexit sha1_base64="v/tj7tuf+7hciryxbktlde8r42w=">aaab8xicbzdlsgmxfizpvnz6q7p0eyzsuikziuhgkorczqv2gu1qmmmmdc1khiqjlkfv4cafim59g3e+jwk7c239ifdxn3piob8fc66n43yjldw19y3n3fz+e2d3b79wcnjuuaioa9birkrte80el6xhubgshstgql+wlj+6ndzbt0xphskhm46zf5kb5agnxfjrsvnc17heviud9qpfp+lmhjfbzaaimwq9wle3h9ekznjqqbtuue5svjqow6lgk3w30swmdeqgrgnrkpbpl51tpmgn1unjifl2synn7u+jliraj0pfdobedpvibwr+v+skjrjyui7jxdbj5x8ficamwtpzcz8rro0ywybucbsrpkoicdu2plwnwv08erma5xxxcv2iwl3j4sjbmzxagvy4hcrcqw0aqehcm7zcg9lobb2jj3nrcspmjucp0ocpmrao5q==</latexit> <latexit sha1_base64="v/tj7tuf+7hciryxbktlde8r42w=">aaab8xicbzdlsgmxfizpvnz6q7p0eyzsuikziuhgkorczqv2gu1qmmmmdc1khiqjlkfv4cafim59g3e+jwk7c239ifdxn3piob8fc66n43yjldw19y3n3fz+e2d3b79wcnjuuaioa9birkrte80el6xhubgshstgql+wlj+6ndzbt0xphskhm46zf5kb5agnxfjrsvnc17heviud9qpfp+lmhjfbzaaimwq9wle3h9ekznjqqbtuue5svjqow6lgk3w30swmdeqgrgnrkpbpl51tpmgn1unjifl2synn7u+jliraj0pfdobedpvibwr+v+skjrjyui7jxdbj5x8ficamwtpzcz8rro0ywybucbsrpkoicdu2plwnwv08erma5xxxcv2iwl3j4sjbmzxagvy4hcrcqw0aqehcm7zcg9lobb2jj3nrcspmjucp0ocpmrao5q==</latexit> <latexit sha1_base64="v/tj7tuf+7hciryxbktlde8r42w=">aaab8xicbzdlsgmxfizpvnz6q7p0eyzsuikziuhgkorczqv2gu1qmmmmdc1khiqjlkfv4cafim59g3e+jwk7c239ifdxn3piob8fc66n43yjldw19y3n3fz+e2d3b79wcnjuuaioa9birkrte80el6xhubgshstgql+wlj+6ndzbt0xphskhm46zf5kb5agnxfjrsvnc17heviud9qpfp+lmhjfbzaaimwq9wle3h9ekznjqqbtuue5svjqow6lgk3w30swmdeqgrgnrkpbpl51tpmgn1unjifl2synn7u+jliraj0pfdobedpvibwr+v+skjrjyui7jxdbj5x8ficamwtpzcz8rro0ywybucbsrpkoicdu2plwnwv08erma5xxxcv2iwl3j4sjbmzxagvy4hcrcqw0aqehcm7zcg9lobb2jj3nrcspmjucp0ocpmrao5q==</latexit> <latexit sha1_base64="v/tj7tuf+7hciryxbktlde8r42w=">aaab8xicbzdlsgmxfizpvnz6q7p0eyzsuikziuhgkorczqv2gu1qmmmmdc1khiqjlkfv4cafim59g3e+jwk7c239ifdxn3piob8fc66n43yjldw19y3n3fz+e2d3b79wcnjuuaioa9birkrte80el6xhubgshstgql+wlj+6ndzbt0xphskhm46zf5kb5agnxfjrsvnc17heviud9qpfp+lmhjfbzaaimwq9wle3h9ekznjqqbtuue5svjqow6lgk3w30swmdeqgrgnrkpbpl51tpmgn1unjifl2synn7u+jliraj0pfdobedpvibwr+v+skjrjyui7jxdbj5x8ficamwtpzcz8rro0ywybucbsrpkoicdu2plwnwv08erma5xxxcv2iwl3j4sjbmzxagvy4hcrcqw0aqehcm7zcg9lobb2jj3nrcspmjucp0ocpmrao5q==</latexit> Incremental View Maintenance (IVM) Basic Idea: Recomputing V from scratch may be an overkill Try to incrementally update parts that change V = Q(D) V 0 = Q(D 0 ) D can be the outcome of inserts and/or deletes to D Q can be a unary query or involve multiple tables Computing V may require inserts and/or deletes to V; realized as algebraic rewrite rules at LQP level Whether or not IVM of V is feasible and/or efficient depends on form of Q, nature of updates to D, data statistics, etc. We will focus only on inserts to D triggering inserts to V 46

47 <latexit sha1_base64="1xebhzmtxpv7c0w2mlvbbllfea8=">aaab/xicbzdlssnafiynxmu9xcvozwarxzvebn0irv24rmveoallmj1ph04mywyi1fb8ftcufhhre7jzbzy2wwjrdwmf/zmhc+ypes6udpxva2fxaxlltbbwxn/y3nq2d3ybkk4lhtqnesxbavhamyc6zppdk5faoobdmxhcj+vnb5ckxejedxpwi9itlgsuagn17p3amb7enezrnmhedxbnck1jl5yymxgebzehespv7dhfxjemaqrcu06uartoov2msm0oh1hrsxukha5id9ogbyla+dnk+he+mk4xh7e0t2g8cx9pzcrsahgfpjmiuq9ma2pzv1o71egfnzgrpboens4ku451jmdr4c6tqdufgibumnmrpn0icdumskijwz398jw0tsuu4buzuuuqj6oadtahokeuokcvdiuqqi4oektp6bw9wu/wi/vufuxbf6x8zg/9kfx5a4ghk1c=</latexit> <latexit sha1_base64="1xebhzmtxpv7c0w2mlvbbllfea8=">aaab/xicbzdlssnafiynxmu9xcvozwarxzvebn0irv24rmveoallmj1ph04mywyi1fb8ftcufhhre7jzbzy2wwjrdwmf/zmhc+ypes6udpxva2fxaxlltbbwxn/y3nq2d3ybkk4lhtqnesxbavhamyc6zppdk5faoobdmxhcj+vnb5ckxejedxpwi9itlgsuagn17p3amb7enezrnmhedxbnck1jl5yymxgebzehespv7dhfxjemaqrcu06uartoov2msm0oh1hrsxukha5id9ogbyla+dnk+he+mk4xh7e0t2g8cx9pzcrsahgfpjmiuq9ma2pzv1o71egfnzgrpboens4ku451jmdr4c6tqdufgibumnmrpn0icdumskijwz398jw0tsuu4buzuuuqj6oadtahokeuokcvdiuqqi4oektp6bw9wu/wi/vufuxbf6x8zg/9kfx5a4ghk1c=</latexit> <latexit sha1_base64="1xebhzmtxpv7c0w2mlvbbllfea8=">aaab/xicbzdlssnafiynxmu9xcvozwarxzvebn0irv24rmveoallmj1ph04mywyi1fb8ftcufhhre7jzbzy2wwjrdwmf/zmhc+ypes6udpxva2fxaxlltbbwxn/y3nq2d3ybkk4lhtqnesxbavhamyc6zppdk5faoobdmxhcj+vnb5ckxejedxpwi9itlgsuagn17p3amb7enezrnmhedxbnck1jl5yymxgebzehespv7dhfxjemaqrcu06uartoov2msm0oh1hrsxukha5id9ogbyla+dnk+he+mk4xh7e0t2g8cx9pzcrsahgfpjmiuq9ma2pzv1o71egfnzgrpboens4ku451jmdr4c6tqdufgibumnmrpn0icdumskijwz398jw0tsuu4buzuuuqj6oadtahokeuokcvdiuqqi4oektp6bw9wu/wi/vufuxbf6x8zg/9kfx5a4ghk1c=</latexit> <latexit sha1_base64="1xebhzmtxpv7c0w2mlvbbllfea8=">aaab/xicbzdlssnafiynxmu9xcvozwarxzvebn0irv24rmveoallmj1ph04mywyi1fb8ftcufhhre7jzbzy2wwjrdwmf/zmhc+ypes6udpxva2fxaxlltbbwxn/y3nq2d3ybkk4lhtqnesxbavhamyc6zppdk5faoobdmxhcj+vnb5ckxejedxpwi9itlgsuagn17p3amb7enezrnmhedxbnck1jl5yymxgebzehespv7dhfxjemaqrcu06uartoov2msm0oh1hrsxukha5id9ogbyla+dnk+he+mk4xh7e0t2g8cx9pzcrsahgfpjmiuq9ma2pzv1o71egfnzgrpboens4ku451jmdr4c6tqdufgibumnmrpn0icdumskijwz398jw0tsuu4buzuuuqj6oadtahokeuokcvdiuqqi4oektp6bw9wu/wi/vufuxbf6x8zg/9kfx5a4ghk1c=</latexit> <latexit sha1_base64="gryid+fzwj3q7fiqbhmff6psnz8=">aaacgnicbvdnssnagnz4w+tf1koxxslws0le0itq1imhd1vswmhc2gw37dpnnuxuhbl6hf58fs8efpemxnwbn20o2jqwmmx8h/vnbamjulnwtze3v7c4tfxaka+urw9smlvbjuspwksjoeoihsbjgi1ju1hfsdsrbeubi61gcjh7rqcijoxxnromxitql6yhxuhpytdt5wceqqe6oe2gm1dfjzdqu5u1bl8nob+61lemqu4lyqrb20pfrfg1aww4s+ycvecbhm9+ul2o04jecjmkzce2euvlscikgrmv3vssboeb6pgopjgkipsycbqr3ndkf4zc6bcrofz/b2qokniybxoyp1xoe7n4n9djvxjqztroukvippkotbluhoy9ws4voj4baokwoppwiptiikx0m2vdgj0dezy4rzvb85vjsv28qkmedseeqaibnia6uain0aqypijn8arejcfjxxg3piajc0axswp+wpj6azgan/o=</latexit> <latexit sha1_base64="gryid+fzwj3q7fiqbhmff6psnz8=">aaacgnicbvdnssnagnz4w+tf1koxxslws0le0itq1imhd1vswmhc2gw37dpnnuxuhbl6hf58fs8efpemxnwbn20o2jqwmmx8h/vnbamjulnwtze3v7c4tfxaka+urw9smlvbjuspwksjoeoihsbjgi1ju1hfsdsrbeubi61gcjh7rqcijoxxnromxitql6yhxuhpytdt5wceqqe6oe2gm1dfjzdqu5u1bl8nob+61lemqu4lyqrb20pfrfg1aww4s+ycvecbhm9+ul2o04jecjmkzce2euvlscikgrmv3vssboeb6pgopjgkipsycbqr3ndkf4zc6bcrofz/b2qokniybxoyp1xoe7n4n9djvxjqztroukvippkotbluhoy9ws4voj4baokwoppwiptiikx0m2vdgj0dezy4rzvb85vjsv28qkmedseeqaibnia6uain0aqypijn8arejcfjxxg3piajc0axswp+wpj6azgan/o=</latexit> <latexit sha1_base64="gryid+fzwj3q7fiqbhmff6psnz8=">aaacgnicbvdnssnagnz4w+tf1koxxslws0le0itq1imhd1vswmhc2gw37dpnnuxuhbl6hf58fs8efpemxnwbn20o2jqwmmx8h/vnbamjulnwtze3v7c4tfxaka+urw9smlvbjuspwksjoeoihsbjgi1ju1hfsdsrbeubi61gcjh7rqcijoxxnromxitql6yhxuhpytdt5wceqqe6oe2gm1dfjzdqu5u1bl8nob+61lemqu4lyqrb20pfrfg1aww4s+ycvecbhm9+ul2o04jecjmkzce2euvlscikgrmv3vssboeb6pgopjgkipsycbqr3ndkf4zc6bcrofz/b2qokniybxoyp1xoe7n4n9djvxjqztroukvippkotbluhoy9ws4voj4baokwoppwiptiikx0m2vdgj0dezy4rzvb85vjsv28qkmedseeqaibnia6uain0aqypijn8arejcfjxxg3piajc0axswp+wpj6azgan/o=</latexit> <latexit sha1_base64="gryid+fzwj3q7fiqbhmff6psnz8=">aaacgnicbvdnssnagnz4w+tf1koxxslws0le0itq1imhd1vswmhc2gw37dpnnuxuhbl6hf58fs8efpemxnwbn20o2jqwmmx8h/vnbamjulnwtze3v7c4tfxaka+urw9smlvbjuspwksjoeoihsbjgi1ju1hfsdsrbeubi61gcjh7rqcijoxxnromxitql6yhxuhpytdt5wceqqe6oe2gm1dfjzdqu5u1bl8nob+61lemqu4lyqrb20pfrfg1aww4s+ycvecbhm9+ul2o04jecjmkzce2euvlscikgrmv3vssboeb6pgopjgkipsycbqr3ndkf4zc6bcrofz/b2qokniybxoyp1xoe7n4n9djvxjqztroukvippkotbluhoy9ws4voj4baokwoppwiptiikx0m2vdgj0dezy4rzvb85vjsv28qkmedseeqaibnia6uain0aqypijn8arejcfjxxg3piajc0axswp+wpj6azgan/o=</latexit> <latexit sha1_base64="jb2y+hctjvne1r3czvsnxr5nbnu=">aaacfhicbvdlsgmxfm3uv62vuzdugkwocgvgbf0w3bhwucu+odmmmtttxmasickozehhupfx3lhqxk0ld/6nmbylbt0qojxzl7nnhamjsjvot1vywfxaximultbwnza37o2dphkpxksbbroyhsjfgowkoalmpj1igukqkvy4umj91j2rigp+q4cj8wpu4zsiggkjbfzre3qmrbpjkr6gl9dai5huu53vpbgjoj+6mmemkjehgv12qs4ycj64u1igu9qd+8vrcpzghgvmkfid10m0nygpkwzkvpjsrrkeb6hhoozyfbplz+nqi3hglc6mhdspazhwf29kkfzqgidmmr9yzxq5+j/xsxv05meuj6kmhe8+iligtyb5q7blpcnnhoyglkm5fei+kghr02pjlodorp4nzeoqa/j1sbl2pq2jcpbapqgaf5ycgrgeddaagdycz/ak3qwn68v6tz4mowvrurml/sd6/ae8dp7s</latexit> <latexit sha1_base64="jb2y+hctjvne1r3czvsnxr5nbnu=">aaacfhicbvdlsgmxfm3uv62vuzdugkwocgvgbf0w3bhwucu+odmmmtttxmasickozehhupfx3lhqxk0ld/6nmbylbt0qojxzl7nnhamjsjvot1vywfxaximultbwnza37o2dphkpxksbbroyhsjfgowkoalmpj1igukqkvy4umj91j2rigp+q4cj8wpu4zsiggkjbfzre3qmrbpjkr6gl9dai5huu53vpbgjoj+6mmemkjehgv12qs4ycj64u1igu9qd+8vrcpzghgvmkfid10m0nygpkwzkvpjsrrkeb6hhoozyfbplz+nqi3hglc6mhdspazhwf29kkfzqgidmmr9yzxq5+j/xsxv05meuj6kmhe8+iligtyb5q7blpcnnhoyglkm5fei+kghr02pjlodorp4nzeoqa/j1sbl2pq2jcpbapqgaf5ycgrgeddaagdycz/ak3qwn68v6tz4mowvrurml/sd6/ae8dp7s</latexit> <latexit sha1_base64="jb2y+hctjvne1r3czvsnxr5nbnu=">aaacfhicbvdlsgmxfm3uv62vuzdugkwocgvgbf0w3bhwucu+odmmmtttxmasickozehhupfx3lhqxk0ld/6nmbylbt0qojxzl7nnhamjsjvot1vywfxaximultbwnza37o2dphkpxksbbroyhsjfgowkoalmpj1igukqkvy4umj91j2rigp+q4cj8wpu4zsiggkjbfzre3qmrbpjkr6gl9dai5huu53vpbgjoj+6mmemkjehgv12qs4ycj64u1igu9qd+8vrcpzghgvmkfid10m0nygpkwzkvpjsrrkeb6hhoozyfbplz+nqi3hglc6mhdspazhwf29kkfzqgidmmr9yzxq5+j/xsxv05meuj6kmhe8+iligtyb5q7blpcnnhoyglkm5fei+kghr02pjlodorp4nzeoqa/j1sbl2pq2jcpbapqgaf5ycgrgeddaagdycz/ak3qwn68v6tz4mowvrurml/sd6/ae8dp7s</latexit> <latexit sha1_base64="jb2y+hctjvne1r3czvsnxr5nbnu=">aaacfhicbvdlsgmxfm3uv62vuzdugkwocgvgbf0w3bhwucu+odmmmtttxmasickozehhupfx3lhqxk0ld/6nmbylbt0qojxzl7nnhamjsjvot1vywfxaximultbwnza37o2dphkpxksbbroyhsjfgowkoalmpj1igukqkvy4umj91j2rigp+q4cj8wpu4zsiggkjbfzre3qmrbpjkr6gl9dai5huu53vpbgjoj+6mmemkjehgv12qs4ycj64u1igu9qd+8vrcpzghgvmkfid10m0nygpkwzkvpjsrrkeb6hhoozyfbplz+nqi3hglc6mhdspazhwf29kkfzqgidmmr9yzxq5+j/xsxv05meuj6kmhe8+iligtyb5q7blpcnnhoyglkm5fei+kghr02pjlodorp4nzeoqa/j1sbl2pq2jcpbapqgaf5ycgrgeddaagdycz/ak3qwn68v6tz4mowvrurml/sd6/ae8dp7s</latexit> <latexit sha1_base64="exj9dgw6eenzohotiipjagtjikm=">aaacghicbvdlsgmxfm34rpvvdekmwatd6iwiuix249jxq9apjzpeqcfmmir3ldl0m9z4k25ckolwnx9jpu1cqwcch3pu5eackjxcou9/evptm7nz86wf8uls8spqzw29axvmods4ltrcrmycfaoakfdctwqajzge6+iuxvjx92cs0ook+ym0e9ztihacozm6lf0mdsxeyizrdzs0opewtpgwvbwyx4iejnwtuqkyhuxc7hyqvx/ph4l+jcgyvmkyz53kz9jvpetaizfm2lbgp9jomuhbjqzkywyhzfyo9adlqgij2hy+ddag207p0lgb9xtsofpzi2ejtf0kcppfl+2kv4j/ea0m4+n2llsaisg+ohrnkqkmruu0k4xllvuomg5cek75ltomo+uy7eoijip/jc2dvcdx88nq7wrcr4lski2yqwjyrgrkljyrbuhkktytv/lmpxkv3rv3mrqd8sy7g+qxvm9vzb2gmg==</latexit> <latexit sha1_base64="exj9dgw6eenzohotiipjagtjikm=">aaacghicbvdlsgmxfm34rpvvdekmwatd6iwiuix249jxq9apjzpeqcfmmir3ldl0m9z4k25ckolwnx9jpu1cqwcch3pu5eackjxcou9/evptm7nz86wf8uls8spqzw29axvmods4ltrcrmycfaoakfdctwqajzge6+iuxvjx92cs0ook+ym0e9ztihacozm6lf0mdsxeyizrdzs0opewtpgwvbwyx4iejnwtuqkyhuxc7hyqvx/ph4l+jcgyvmkyz53kz9jvpetaizfm2lbgp9jomuhbjqzkywyhzfyo9adlqgij2hy+ddag207p0lgb9xtsofpzi2ejtf0kcppfl+2kv4j/ea0m4+n2llsaisg+ohrnkqkmruu0k4xllvuomg5cek75ltomo+uy7eoijip/jc2dvcdx88nq7wrcr4lski2yqwjyrgrkljyrbuhkktytv/lmpxkv3rv3mrqd8sy7g+qxvm9vzb2gmg==</latexit> <latexit sha1_base64="exj9dgw6eenzohotiipjagtjikm=">aaacghicbvdlsgmxfm34rpvvdekmwatd6iwiuix249jxq9apjzpeqcfmmir3ldl0m9z4k25ckolwnx9jpu1cqwcch3pu5eackjxcou9/evptm7nz86wf8uls8spqzw29axvmods4ltrcrmycfaoakfdctwqajzge6+iuxvjx92cs0ook+ym0e9ztihacozm6lf0mdsxeyizrdzs0opewtpgwvbwyx4iejnwtuqkyhuxc7hyqvx/ph4l+jcgyvmkyz53kz9jvpetaizfm2lbgp9jomuhbjqzkywyhzfyo9adlqgij2hy+ddag207p0lgb9xtsofpzi2ejtf0kcppfl+2kv4j/ea0m4+n2llsaisg+ohrnkqkmruu0k4xllvuomg5cek75ltomo+uy7eoijip/jc2dvcdx88nq7wrcr4lski2yqwjyrgrkljyrbuhkktytv/lmpxkv3rv3mrqd8sy7g+qxvm9vzb2gmg==</latexit> <latexit sha1_base64="exj9dgw6eenzohotiipjagtjikm=">aaacghicbvdlsgmxfm34rpvvdekmwatd6iwiuix249jxq9apjzpeqcfmmir3ldl0m9z4k25ckolwnx9jpu1cqwcch3pu5eackjxcou9/evptm7nz86wf8uls8spqzw29axvmods4ltrcrmycfaoakfdctwqajzge6+iuxvjx92cs0ook+ym0e9ztihacozm6lf0mdsxeyizrdzs0opewtpgwvbwyx4iejnwtuqkyhuxc7hyqvx/ph4l+jcgyvmkyz53kz9jvpetaizfm2lbgp9jomuhbjqzkywyhzfyo9adlqgij2hy+ddag207p0lgb9xtsofpzi2ejtf0kcppfl+2kv4j/ea0m4+n2llsaisg+ohrnkqkmruu0k4xllvuomg5cek75ltomo+uy7eoijip/jc2dvcdx88nq7wrcr4lski2yqwjyrgrkljyrbuhkktytv/lmpxkv3rv3mrqd8sy7g+qxvm9vzb2gmg==</latexit> <latexit sha1_base64="si5+rcdubx9i9nvd6etkqzt6obs=">aaachnicbvdlsgmxfm3uv62vuzdugkxujcyiohuhwbcufbuknviy6w0bmskmyr2hdp0sn/6kgxekck70b8zulnwdcbzoozebe8jecooe9+eujianpmeks6w5+yxfjxd5pw7ivhoo8vjg+izkbqrqueobem4sdswkjvyh/wrux9+cnijwvzhiobmxrhidwrlaqexu1zfpea3tgkcjdyzorqwvrax7arnlkmcxgqu2ympdreaejdj6sd1yy96onwl9s/wxkzmxzlruw9coerqbqi6zmq3fs7czmy2csxiwgtrawnifdafhqwirmgy2om9in6zspp1y26eqjttvexmljbleou3mpze/vvz8z2uk2dlszkilkylix4s6qaqy07wr2hbafiahljcubqmc8h7tjknttgrl8h+f/jfud3d8y8/3ypxjcr1fskbwyrbxyqgpkfnyrmqekzvyqj7is3pvpdovzutxtocmz1bjdzjvn79roag=</latexit> <latexit sha1_base64="si5+rcdubx9i9nvd6etkqzt6obs=">aaachnicbvdlsgmxfm3uv62vuzdugkxujcyiohuhwbcufbuknviy6w0bmskmyr2hdp0sn/6kgxekck70b8zulnwdcbzoozebe8jecooe9+eujianpmeks6w5+yxfjxd5pw7ivhoo8vjg+izkbqrqueobem4sdswkjvyh/wrux9+cnijwvzhiobmxrhidwrlaqexu1zfpea3tgkcjdyzorqwvrax7arnlkmcxgqu2ympdreaejdj6sd1yy96onwl9s/wxkzmxzlruw9coerqbqi6zmq3fs7czmy2csxiwgtrawnifdafhqwirmgy2om9in6zspp1y26eqjttvexmljbleou3mpze/vvz8z2uk2dlszkilkylix4s6qaqy07wr2hbafiahljcubqmc8h7tjknttgrl8h+f/jfud3d8y8/3ypxjcr1fskbwyrbxyqgpkfnyrmqekzvyqj7is3pvpdovzutxtocmz1bjdzjvn79roag=</latexit> <latexit sha1_base64="si5+rcdubx9i9nvd6etkqzt6obs=">aaachnicbvdlsgmxfm3uv62vuzdugkxujcyiohuhwbcufbuknviy6w0bmskmyr2hdp0sn/6kgxekck70b8zulnwdcbzoozebe8jecooe9+eujianpmeks6w5+yxfjxd5pw7ivhoo8vjg+izkbqrqueobem4sdswkjvyh/wrux9+cnijwvzhiobmxrhidwrlaqexu1zfpea3tgkcjdyzorqwvrax7arnlkmcxgqu2ympdreaejdj6sd1yy96onwl9s/wxkzmxzlruw9coerqbqi6zmq3fs7czmy2csxiwgtrawnifdafhqwirmgy2om9in6zspp1y26eqjttvexmljbleou3mpze/vvz8z2uk2dlszkilkylix4s6qaqy07wr2hbafiahljcubqmc8h7tjknttgrl8h+f/jfud3d8y8/3ypxjcr1fskbwyrbxyqgpkfnyrmqekzvyqj7is3pvpdovzutxtocmz1bjdzjvn79roag=</latexit> <latexit sha1_base64="si5+rcdubx9i9nvd6etkqzt6obs=">aaachnicbvdlsgmxfm3uv62vuzdugkxujcyiohuhwbcufbuknviy6w0bmskmyr2hdp0sn/6kgxekck70b8zulnwdcbzoozebe8jecooe9+eujianpmeks6w5+yxfjxd5pw7ivhoo8vjg+izkbqrqueobem4sdswkjvyh/wrux9+cnijwvzhiobmxrhidwrlaqexu1zfpea3tgkcjdyzorqwvrax7arnlkmcxgqu2ympdreaejdj6sd1yy96onwl9s/wxkzmxzlruw9coerqbqi6zmq3fs7czmy2csxiwgtrawnifdafhqwirmgy2om9in6zspp1y26eqjttvexmljbleou3mpze/vvz8z2uk2dlszkilkylix4s6qaqy07wr2hbafiahljcubqmc8h7tjknttgrl8h+f/jfud3d8y8/3ypxjcr1fskbwyrbxyqgpkfnyrmqekzvyqj7is3pvpdovzutxtocmz1bjdzjvn79roag=</latexit> Incremental View Maintenance (IVM) Unary IVM for insertions: R 0 = R [ R Newly inserted tuples Select: Project: V SelectCondition(R) V 0 = V [ SelectCondition ( R) Can be just an append (union with bag semantics) V ProjectionList (R) V 0 = V [ ProjectionList ( R) Requires full set union with V for deduplication Select and Project can be composed and reordered as before 47

48 <latexit sha1_base64="po07uw9ayunl5/uwsc6vj2c5hbe=">aaacvhichvfbsxtbfj5dtdxypqkevqwgaqil7bzbl4vye+hbw6vzmjin4e1kshkys7vmvc2ezx+kprt6s3rx4crgsfrog4gp73sf771vokwkg57323hx1isvnja3qtsvx9ve19/s9eyaa8ydlspu9ymwxiqebyhq8n6moahi8utodrrqr39wbusadhge8agcobetwqatnarpem/pbxrgobsmilabtguwj3f8zmex7x6iq+c8bh5vlc0edvme/d9w+jx40l1aapijswr62rrvg17bwxz9dvwvajbvxyzqp8nxynlfe2qsjbn4xobdajqkjnlzdxpdm2azipnawgqun8nigupjdywzppnu25cgxbkphquoy+yqsp2lnc1tbuh+sxvkodkefiljcuqjux80ysxflc4spmohoum5twcyfnzxyqaggah9h6onwx968npqe9/2lf522oh8xmwxsfbipmksnxyrdvlmlkhaglkhfxziom4v59zdcyv3ra6z8uysv8qt3qfpkrkt</latexit> <latexit sha1_base64="po07uw9ayunl5/uwsc6vj2c5hbe=">aaacvhichvfbsxtbfj5dtdxypqkevqwgaqil7bzbl4vye+hbw6vzmjin4e1kshkys7vmvc2ezx+kprt6s3rx4crgsfrog4gp73sf771vokwkg57323hx1isvnja3qtsvx9ve19/s9eyaa8ydlspu9ymwxiqebyhq8n6moahi8utodrrqr39wbusadhge8agcobetwqatnarpem/pbxrgobsmilabtguwj3f8zmex7x6iq+c8bh5vlc0edvme/d9w+jx40l1aapijswr62rrvg17bwxz9dvwvajbvxyzqp8nxynlfe2qsjbn4xobdajqkjnlzdxpdm2azipnawgqun8nigupjdywzppnu25cgxbkphquoy+yqsp2lnc1tbuh+sxvkodkefiljcuqjux80ysxflc4spmohoum5twcyfnzxyqaggah9h6onwx968npqe9/2lf522oh8xmwxsfbipmksnxyrdvlmlkhaglkhfxziom4v59zdcyv3ra6z8uysv8qt3qfpkrkt</latexit> <latexit sha1_base64="po07uw9ayunl5/uwsc6vj2c5hbe=">aaacvhichvfbsxtbfj5dtdxypqkevqwgaqil7bzbl4vye+hbw6vzmjin4e1kshkys7vmvc2ezx+kprt6s3rx4crgsfrog4gp73sf771vokwkg57323hx1isvnja3qtsvx9ve19/s9eyaa8ydlspu9ymwxiqebyhq8n6moahi8utodrrqr39wbusadhge8agcobetwqatnarpem/pbxrgobsmilabtguwj3f8zmex7x6iq+c8bh5vlc0edvme/d9w+jx40l1aapijswr62rrvg17bwxz9dvwvajbvxyzqp8nxynlfe2qsjbn4xobdajqkjnlzdxpdm2azipnawgqun8nigupjdywzppnu25cgxbkphquoy+yqsp2lnc1tbuh+sxvkodkefiljcuqjux80ysxflc4spmohoum5twcyfnzxyqaggah9h6onwx968npqe9/2lf522oh8xmwxsfbipmksnxyrdvlmlkhaglkhfxziom4v59zdcyv3ra6z8uysv8qt3qfpkrkt</latexit> <latexit sha1_base64="po07uw9ayunl5/uwsc6vj2c5hbe=">aaacvhichvfbsxtbfj5dtdxypqkevqwgaqil7bzbl4vye+hbw6vzmjin4e1kshkys7vmvc2ezx+kprt6s3rx4crgsfrog4gp73sf771vokwkg57323hx1isvnja3qtsvx9ve19/s9eyaa8ydlspu9ymwxiqebyhq8n6moahi8utodrrqr39wbusadhge8agcobetwqatnarpem/pbxrgobsmilabtguwj3f8zmex7x6iq+c8bh5vlc0edvme/d9w+jx40l1aapijswr62rrvg17bwxz9dvwvajbvxyzqp8nxynlfe2qsjbn4xobdajqkjnlzdxpdm2azipnawgqun8nigupjdywzppnu25cgxbkphquoy+yqsp2lnc1tbuh+sxvkodkefiljcuqjux80ysxflc4spmohoum5twcyfnzxyqaggah9h6onwx968npqe9/2lf522oh8xmwxsfbipmksnxyrdvlmlkhaglkhfxziom4v59zdcyv3ra6z8uysv8qt3qfpkrkt</latexit> <latexit sha1_base64="qqwarvhkyintuvehxd+xxp2ge2w=">aaacunicjvllsgmxfe3ru76qlt0ei1hbzeye3qi+fgoqvwxvoqxcsdmxmmwmyr2hdpongrjxq9y4unoh4gvhgcdhnhu5nyfxyykmos5zlj80pdi6nj5rmjyanpktzs3xtjroxqsskpg+9sfwkujerygsx8eag/ilv/lvdrr+1t3xrkthjxzi3laqhkitgkcvmkvrw6e71atakwimngk8fzjubcgjnz2tfqqnx2dz+wy1k9eox5l4/w3uo+qsgv6snoslz93pgf4m7ocuyacvzvhra0usutxejsgyuuve2ehbo2cszwuvmtwgdgcbr1sagukmkfyiyeiyvvq0hwl7qqq99wthcsqyjvjtzxdj89prin959qtb241uhhgcpgt9qe1euoxon1/aepozlb1lgglhd6xsfjqwtk9qscg4p6/8m9q21l3lzzdlu/udombjilkizekslbjljkifvakjd+sfvjh33fpunw9/sb80nxv0ljbvye99apixs8c=</latexit> <latexit sha1_base64="qqwarvhkyintuvehxd+xxp2ge2w=">aaacunicjvllsgmxfe3ru76qlt0ei1hbzeye3qi+fgoqvwxvoqxcsdmxmmwmyr2hdpongrjxq9y4unoh4gvhgcdhnhu5nyfxyykmos5zlj80pdi6nj5rmjyanpktzs3xtjroxqsskpg+9sfwkujerygsx8eag/ilv/lvdrr+1t3xrkthjxzi3laqhkitgkcvmkvrw6e71atakwimngk8fzjubcgjnz2tfqqnx2dz+wy1k9eox5l4/w3uo+qsgv6snoslz93pgf4m7ocuyacvzvhra0usutxejsgyuuve2ehbo2cszwuvmtwgdgcbr1sagukmkfyiyeiyvvq0hwl7qqq99wthcsqyjvjtzxdj89prin959qtb241uhhgcpgt9qe1euoxon1/aepozlb1lgglhd6xsfjqwtk9qscg4p6/8m9q21l3lzzdlu/udombjilkizekslbjljkifvakjd+sfvjh33fpunw9/sb80nxv0ljbvye99apixs8c=</latexit> <latexit sha1_base64="qqwarvhkyintuvehxd+xxp2ge2w=">aaacunicjvllsgmxfe3ru76qlt0ei1hbzeye3qi+fgoqvwxvoqxcsdmxmmwmyr2hdpongrjxq9y4unoh4gvhgcdhnhu5nyfxyykmos5zlj80pdi6nj5rmjyanpktzs3xtjroxqsskpg+9sfwkujerygsx8eag/ilv/lvdrr+1t3xrkthjxzi3laqhkitgkcvmkvrw6e71atakwimngk8fzjubcgjnz2tfqqnx2dz+wy1k9eox5l4/w3uo+qsgv6snoslz93pgf4m7ocuyacvzvhra0usutxejsgyuuve2ehbo2cszwuvmtwgdgcbr1sagukmkfyiyeiyvvq0hwl7qqq99wthcsqyjvjtzxdj89prin959qtb241uhhgcpgt9qe1euoxon1/aepozlb1lgglhd6xsfjqwtk9qscg4p6/8m9q21l3lzzdlu/udombjilkizekslbjljkifvakjd+sfvjh33fpunw9/sb80nxv0ljbvye99apixs8c=</latexit> <latexit sha1_base64="qqwarvhkyintuvehxd+xxp2ge2w=">aaacunicjvllsgmxfe3ru76qlt0ei1hbzeye3qi+fgoqvwxvoqxcsdmxmmwmyr2hdpongrjxq9y4unoh4gvhgcdhnhu5nyfxyykmos5zlj80pdi6nj5rmjyanpktzs3xtjroxqsskpg+9sfwkujerygsx8eag/ilv/lvdrr+1t3xrkthjxzi3laqhkitgkcvmkvrw6e71atakwimngk8fzjubcgjnz2tfqqnx2dz+wy1k9eox5l4/w3uo+qsgv6snoslz93pgf4m7ocuyacvzvhra0usutxejsgyuuve2ehbo2cszwuvmtwgdgcbr1sagukmkfyiyeiyvvq0hwl7qqq99wthcsqyjvjtzxdj89prin959qtb241uhhgcpgt9qe1euoxon1/aepozlb1lgglhd6xsfjqwtk9qscg4p6/8m9q21l3lzzdlu/udombjilkizekslbjljkifvakjd+sfvjh33fpunw9/sb80nxv0ljbvye99apixs8c=</latexit> <latexit sha1_base64="j9jszsiteni8meg8cj4waxvatmo=">aaacunicjvllsgmxfe3rq9zx1awbyberimyiobvb18kfqn20kp1s7qtpnjjmdmkdoqzzjyk48upcufdtwshxwgobwzn3cm9o4sdsghscp1x+zhrsfkiwwzyanpmdk80v1e2uamzrljkrvvbbcclcxkobkl/hmopyjb/ybw/7/tud10ze4sx2yt5ueisiixiglvoluv+lu9qlqclopz4c7apm94pgxm7o1j+fi9ppvrlzyyp16rek/n8d9y64rkdna61s2dlwbqc/itskztjetvv68norsxqpkukwpue6mtzt0ciy5fnrswypgd1cwbuwhqc4aaadsdk6ypu27utanhdpqp3akyiypqd8w9nf2pz0+ujfxipbzk4zfwgcia/zx6boiilgtj8vbqvngcqejcc0slts1gundo0rfg0i7s8r/yb1zq3x8rot8t7bmi4cwsllpejcsk32ydgpkhph5j48k1fylnvmvettl/kozeegpyvkg/lt7ysds+k=</latexit> <latexit sha1_base64="j9jszsiteni8meg8cj4waxvatmo=">aaacunicjvllsgmxfe3rq9zx1awbyberimyiobvb18kfqn20kp1s7qtpnjjmdmkdoqzzjyk48upcufdtwshxwgobwzn3cm9o4sdsghscp1x+zhrsfkiwwzyanpmdk80v1e2uamzrljkrvvbbcclcxkobkl/hmopyjb/ybw/7/tud10ze4sx2yt5ueisiixiglvoluv+lu9qlqclopz4c7apm94pgxm7o1j+fi9ppvrlzyyp16rek/n8d9y64rkdna61s2dlwbqc/itskztjetvv68norsxqpkukwpue6mtzt0ciy5fnrswypgd1cwbuwhqc4aaadsdk6ypu27utanhdpqp3akyiypqd8w9nf2pz0+ujfxipbzk4zfwgcia/zx6boiilgtj8vbqvngcqejcc0slts1gundo0rfg0i7s8r/yb1zq3x8rot8t7bmi4cwsllpejcsk32ydgpkhph5j48k1fylnvmvettl/kozeegpyvkg/lt7ysds+k=</latexit> <latexit sha1_base64="j9jszsiteni8meg8cj4waxvatmo=">aaacunicjvllsgmxfe3rq9zx1awbyberimyiobvb18kfqn20kp1s7qtpnjjmdmkdoqzzjyk48upcufdtwshxwgobwzn3cm9o4sdsghscp1x+zhrsfkiwwzyanpmdk80v1e2uamzrljkrvvbbcclcxkobkl/hmopyjb/ybw/7/tud10ze4sx2yt5ueisiixiglvoluv+lu9qlqclopz4c7apm94pgxm7o1j+fi9ppvrlzyyp16rek/n8d9y64rkdna61s2dlwbqc/itskztjetvv68norsxqpkukwpue6mtzt0ciy5fnrswypgd1cwbuwhqc4aaadsdk6ypu27utanhdpqp3akyiypqd8w9nf2pz0+ujfxipbzk4zfwgcia/zx6boiilgtj8vbqvngcqejcc0slts1gundo0rfg0i7s8r/yb1zq3x8rot8t7bmi4cwsllpejcsk32ydgpkhph5j48k1fylnvmvettl/kozeegpyvkg/lt7ysds+k=</latexit> <latexit sha1_base64="j9jszsiteni8meg8cj4waxvatmo=">aaacunicjvllsgmxfe3rq9zx1awbyberimyiobvb18kfqn20kp1s7qtpnjjmdmkdoqzzjyk48upcufdtwshxwgobwzn3cm9o4sdsghscp1x+zhrsfkiwwzyanpmdk80v1e2uamzrljkrvvbbcclcxkobkl/hmopyjb/ybw/7/tud10ze4sx2yt5ueisiixiglvoluv+lu9qlqclopz4c7apm94pgxm7o1j+fi9ppvrlzyyp16rek/n8d9y64rkdna61s2dlwbqc/itskztjetvv68norsxqpkukwpue6mtzt0ciy5fnrswypgd1cwbuwhqc4aaadsdk6ypu27utanhdpqp3akyiypqd8w9nf2pz0+ujfxipbzk4zfwgcia/zx6boiilgtj8vbqvngcqejcc0slts1gundo0rfg0i7s8r/yb1zq3x8rot8t7bmi4cwsllpejcsk32ydgpkhph5j48k1fylnvmvettl/kozeegpyvkg/lt7ysds+k=</latexit> <latexit sha1_base64="1xebhzmtxpv7c0w2mlvbbllfea8=">aaab/xicbzdlssnafiynxmu9xcvozwarxzvebn0irv24rmveoallmj1ph04mywyi1fb8ftcufhhre7jzbzy2wwjrdwmf/zmhc+ypes6udpxva2fxaxlltbbwxn/y3nq2d3ybkk4lhtqnesxbavhamyc6zppdk5faoobdmxhcj+vnb5ckxejedxpwi9itlgsuagn17p3amb7enezrnmhedxbnck1jl5yymxgebzehespv7dhfxjemaqrcu06uartoov2msm0oh1hrsxukha5id9ogbyla+dnk+he+mk4xh7e0t2g8cx9pzcrsahgfpjmiuq9ma2pzv1o71egfnzgrpboens4ku451jmdr4c6tqdufgibumnmrpn0icdumskijwz398jw0tsuu4buzuuuqj6oadtahokeuokcvdiuqqi4oektp6bw9wu/wi/vufuxbf6x8zg/9kfx5a4ghk1c=</latexit> <latexit sha1_base64="1xebhzmtxpv7c0w2mlvbbllfea8=">aaab/xicbzdlssnafiynxmu9xcvozwarxzvebn0irv24rmveoallmj1ph04mywyi1fb8ftcufhhre7jzbzy2wwjrdwmf/zmhc+ypes6udpxva2fxaxlltbbwxn/y3nq2d3ybkk4lhtqnesxbavhamyc6zppdk5faoobdmxhcj+vnb5ckxejedxpwi9itlgsuagn17p3amb7enezrnmhedxbnck1jl5yymxgebzehespv7dhfxjemaqrcu06uartoov2msm0oh1hrsxukha5id9ogbyla+dnk+he+mk4xh7e0t2g8cx9pzcrsahgfpjmiuq9ma2pzv1o71egfnzgrpboens4ku451jmdr4c6tqdufgibumnmrpn0icdumskijwz398jw0tsuu4buzuuuqj6oadtahokeuokcvdiuqqi4oektp6bw9wu/wi/vufuxbf6x8zg/9kfx5a4ghk1c=</latexit> <latexit sha1_base64="1xebhzmtxpv7c0w2mlvbbllfea8=">aaab/xicbzdlssnafiynxmu9xcvozwarxzvebn0irv24rmveoallmj1ph04mywyi1fb8ftcufhhre7jzbzy2wwjrdwmf/zmhc+ypes6udpxva2fxaxlltbbwxn/y3nq2d3ybkk4lhtqnesxbavhamyc6zppdk5faoobdmxhcj+vnb5ckxejedxpwi9itlgsuagn17p3amb7enezrnmhedxbnck1jl5yymxgebzehespv7dhfxjemaqrcu06uartoov2msm0oh1hrsxukha5id9ogbyla+dnk+he+mk4xh7e0t2g8cx9pzcrsahgfpjmiuq9ma2pzv1o71egfnzgrpboens4ku451jmdr4c6tqdufgibumnmrpn0icdumskijwz398jw0tsuu4buzuuuqj6oadtahokeuokcvdiuqqi4oektp6bw9wu/wi/vufuxbf6x8zg/9kfx5a4ghk1c=</latexit> <latexit sha1_base64="1xebhzmtxpv7c0w2mlvbbllfea8=">aaab/xicbzdlssnafiynxmu9xcvozwarxzvebn0irv24rmveoallmj1ph04mywyi1fb8ftcufhhre7jzbzy2wwjrdwmf/zmhc+ypes6udpxva2fxaxlltbbwxn/y3nq2d3ybkk4lhtqnesxbavhamyc6zppdk5faoobdmxhcj+vnb5ckxejedxpwi9itlgsuagn17p3amb7enezrnmhedxbnck1jl5yymxgebzehespv7dhfxjemaqrcu06uartoov2msm0oh1hrsxukha5id9ogbyla+dnk+he+mk4xh7e0t2g8cx9pzcrsahgfpjmiuq9ma2pzv1o71egfnzgrpboens4ku451jmdr4c6tqdufgibumnmrpn0icdumskijwz398jw0tsuu4buzuuuqj6oadtahokeuokcvdiuqqi4oektp6bw9wu/wi/vufuxbf6x8zg/9kfx5a4ghk1c=</latexit> <latexit sha1_base64="ta0eqpjhe96xtp4szsgjuabpdtg=">aaacinicbvdlssnafj34tr6qlt0mfqgcsckcuvoxcefcxvalkevmoomdm0myuvfkyle48vfcufduledhoh0s6upawogce5lzt5bkydb1p52r0bhxicmp6dlm7nz8qnlxqw6stdney4lm9fuahksr8xoklpwq1rxuipllchvu9s/vudyiis+wk/kmgigwowcavmqv9+rulzxe0dq5p34esker9xxgjcd8iipobiziy0goqtfrrfv8vvwuujtud/qv8qakqgy4bzxf/xbcmsvjzbkmaxhuis0cnaomevhym8ntylcq8yalmshumnnvxikuwavnw0tbfyptqcmboshjoiqwk92o5rfxff/zghmgu81cxgmgpgb9j8jmukxoty/afpozlb1lgglhs1j2axoy2lzltgtv98l/sx1r07p8bluyfzioy4qskfvsjr7zifvkmjysgmhkgtyrf/lqpdrpzpvz0r8dcqy7y+qhnk9voz+kta==</latexit> <latexit sha1_base64="ta0eqpjhe96xtp4szsgjuabpdtg=">aaacinicbvdlssnafj34tr6qlt0mfqgcsckcuvoxcefcxvalkevmoomdm0myuvfkyle48vfcufduledhoh0s6upawogce5lzt5bkydb1p52r0bhxicmp6dlm7nz8qnlxqw6stdney4lm9fuahksr8xoklpwq1rxuipllchvu9s/vudyiis+wk/kmgigwowcavmqv9+rulzxe0dq5p34esker9xxgjcd8iipobiziy0goqtfrrfv8vvwuujtud/qv8qakqgy4bzxf/xbcmsvjzbkmaxhuis0cnaomevhym8ntylcq8yalmshumnnvxikuwavnw0tbfyptqcmboshjoiqwk92o5rfxff/zghmgu81cxgmgpgb9j8jmukxoty/afpozlb1lgglhs1j2axoy2lzltgtv98l/sx1r07p8bluyfzioy4qskfvsjr7zifvkmjysgmhkgtyrf/lqpdrpzpvz0r8dcqy7y+qhnk9voz+kta==</latexit> <latexit sha1_base64="ta0eqpjhe96xtp4szsgjuabpdtg=">aaacinicbvdlssnafj34tr6qlt0mfqgcsckcuvoxcefcxvalkevmoomdm0myuvfkyle48vfcufduledhoh0s6upawogce5lzt5bkydb1p52r0bhxicmp6dlm7nz8qnlxqw6stdney4lm9fuahksr8xoklpwq1rxuipllchvu9s/vudyiis+wk/kmgigwowcavmqv9+rulzxe0dq5p34esker9xxgjcd8iipobiziy0goqtfrrfv8vvwuujtud/qv8qakqgy4bzxf/xbcmsvjzbkmaxhuis0cnaomevhym8ntylcq8yalmshumnnvxikuwavnw0tbfyptqcmboshjoiqwk92o5rfxff/zghmgu81cxgmgpgb9j8jmukxoty/afpozlb1lgglhs1j2axoy2lzltgtv98l/sx1r07p8bluyfzioy4qskfvsjr7zifvkmjysgmhkgtyrf/lqpdrpzpvz0r8dcqy7y+qhnk9voz+kta==</latexit> <latexit sha1_base64="ta0eqpjhe96xtp4szsgjuabpdtg=">aaacinicbvdlssnafj34tr6qlt0mfqgcsckcuvoxcefcxvalkevmoomdm0myuvfkyle48vfcufduledhoh0s6upawogce5lzt5bkydb1p52r0bhxicmp6dlm7nz8qnlxqw6stdney4lm9fuahksr8xoklpwq1rxuipllchvu9s/vudyiis+wk/kmgigwowcavmqv9+rulzxe0dq5p34esker9xxgjcd8iipobiziy0goqtfrrfv8vvwuujtud/qv8qakqgy4bzxf/xbcmsvjzbkmaxhuis0cnaomevhym8ntylcq8yalmshumnnvxikuwavnw0tbfyptqcmboshjoiqwk92o5rfxff/zghmgu81cxgmgpgb9j8jmukxoty/afpozlb1lgglhs1j2axoy2lzltgtv98l/sx1r07p8bluyfzioy4qskfvsjr7zifvkmjysgmhkgtyrf/lqpdrpzpvz0r8dcqy7y+qhnk9voz+kta==</latexit> Incremental View Maintenance (IVM) Unary IVM for insertions: R 0 = R [ R Newly inserted tuples Group By Agg: V AggList,Agg(Y )(R) Feasibility of IVM Depends on Agg() function! Rewrite rules exist for SUM, COUNT, and MIN/MAX over bags AVG not possible in general; needs deeper system changes V 0 = AggList,SUM (Y ) (V [ AggList,SUM (Y ) R) V 0 = AggList,SUM (Y ) (V [ AggList,COUNT (Y ) R) V 0 = AggList,MIN (Y ) (V [ AggList,MIN (Y ) R) 48

Parser. Select R.text from Report R, Weather W where W.image.rain() and W.city = R.city and W.date = R.date and R.text.

Parser. Select R.text from Report R, Weather W where W.image.rain() and W.city = R.city and W.date = R.date and R.text. Select R.text from Report R, Weather W where W.image.rain() and W.city = R.city and W.date = R.date and R.text. Lifecycle of a Query CSE 190D Database System Implementation Arun Kumar Query Query Result

More information

CSE 232A Graduate Database Systems

CSE 232A Graduate Database Systems CSE 232A Graduate Database Systems Arun Kumar Topic 3: Relational Operator Implementations Chapters 12 and 14 of Cow Book Slide ACKs: Jignesh Patel, Paris Koutris 1 Lifecycle of a Query Query Result Query

More information

Parser. Select R.text from Report R, Weather W where W.image.rain() and W.city = R.city and W.date = R.date and R.text.

Parser. Select R.text from Report R, Weather W where W.image.rain() and W.city = R.city and W.date = R.date and R.text. Select R.text from Report R, Weather W where W.image.rain() and W.city = R.city and W.date = R.date and R.text. Lifecycle of an SQL Query CSE 190D base System Implementation Arun Kumar Query Query Result

More information

CSE 190D Database System Implementation

CSE 190D Database System Implementation CSE 190D Database System Implementation Arun Kumar Topic 1: Data Storage, Buffer Management, and File Organization Chapters 8 and 9 (except 8.5.4 and 9.2) of Cow Book Slide ACKs: Jignesh Patel, Paris Koutris

More information

Motivation for Sorting. External Sorting: Overview. Outline. CSE 190D Database System Implementation. Topic 3: Sorting. Chapter 13 of Cow Book

Motivation for Sorting. External Sorting: Overview. Outline. CSE 190D Database System Implementation. Topic 3: Sorting. Chapter 13 of Cow Book Motivation for Sorting CSE 190D Database System Implementation Arun Kumar User s SQL query has ORDER BY clause! First step of bulk loading of a B+ tree index Used in implementations of many relational

More information

CSE 232A Graduate Database Systems

CSE 232A Graduate Database Systems CSE 232A Graduate Database Systems Arun Kumar Topic 1: Data Storage Chapters 8 and 9 of Cow Book Slide ACKs: Jignesh Patel, Paris Koutris 1 Lifecycle of an SQL Query Query Result Query Database Server

More information

CSE 232A Graduate Database Systems

CSE 232A Graduate Database Systems CSE 232A Graduate Database Systems Fall 2018 Arun Kumar 1 What is this course about? Why take it? 2 1. IBM s Watson beats humans in Jeapordy! How did Watson achieve that? 4 Watson devoured LOTS of data!

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

Query Processing & Optimization

Query Processing & Optimization Query Processing & Optimization 1 Roadmap of This Lecture Overview of query processing Measures of Query Cost Selection Operation Sorting Join Operation Other Operations Evaluation of Expressions Introduction

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

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

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

CSE 190D Spring 2017 Final Exam Answers

CSE 190D Spring 2017 Final Exam Answers CSE 190D Spring 2017 Final Exam Answers Q 1. [20pts] For the following questions, clearly circle True or False. 1. The hash join algorithm always has fewer page I/Os compared to the block nested loop join

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

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

Introduction to Query Processing and Query Optimization Techniques. Copyright 2011 Ramez Elmasri and Shamkant Navathe

Introduction to Query Processing and Query Optimization Techniques. Copyright 2011 Ramez Elmasri and Shamkant Navathe Introduction to Query Processing and Query Optimization Techniques Outline Translating SQL Queries into Relational Algebra Algorithms for External Sorting Algorithms for SELECT and JOIN Operations Algorithms

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

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 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

Advanced Database Systems

Advanced Database Systems Lecture IV Query Processing Kyumars Sheykh Esmaili Basic Steps in Query Processing 2 Query Optimization Many equivalent execution plans Choosing the best one Based on Heuristics, Cost Will be discussed

More information

CSE 190D Spring 2017 Final Exam

CSE 190D Spring 2017 Final Exam CSE 190D Spring 2017 Final Exam Full Name : Student ID : Major : INSTRUCTIONS 1. You have up to 2 hours and 59 minutes to complete this exam. 2. You can have up to one letter/a4-sized sheet of notes, formulae,

More information

Parser: SQL parse tree

Parser: SQL parse tree Jinze Liu Parser: SQL parse tree Good old lex & yacc Detect and reject syntax errors Validator: parse tree logical plan Detect and reject semantic errors Nonexistent tables/views/columns? Insufficient

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

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

Hash-Based Indexing 165

Hash-Based Indexing 165 Hash-Based Indexing 165 h 1 h 0 h 1 h 0 Next = 0 000 00 64 32 8 16 000 00 64 32 8 16 A 001 01 9 25 41 73 001 01 9 25 41 73 B 010 10 10 18 34 66 010 10 10 18 34 66 C Next = 3 011 11 11 19 D 011 11 11 19

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

Chapter 12: Query Processing

Chapter 12: Query Processing Chapter 12: Query Processing Overview Catalog Information for Cost Estimation $ Measures of Query Cost Selection Operation Sorting Join Operation Other Operations Evaluation of Expressions Transformation

More information

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. CS 564- Spring ACKs: Jeff Naughton, Jignesh Patel, AnHai Doan

QUERY OPTIMIZATION. CS 564- Spring ACKs: Jeff Naughton, Jignesh Patel, AnHai Doan QUERY OPTIMIZATION CS 564- Spring 2018 ACKs: Jeff Naughton, Jignesh Patel, AnHai Doan WHAT IS THIS LECTURE ABOUT? What is a query optimizer? Generating query plans Cost estimation of query plans 2 ARCHITECTURE

More information

Algorithms for Query Processing and Optimization. 0. Introduction to Query Processing (1)

Algorithms for Query Processing and Optimization. 0. Introduction to Query Processing (1) Chapter 19 Algorithms for Query Processing and Optimization 0. Introduction to Query Processing (1) Query optimization: The process of choosing a suitable execution strategy for processing a query. Two

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

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

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

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

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

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

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

Data Modeling and Databases Ch 10: Query Processing - Algorithms. Gustavo Alonso Systems Group Department of Computer Science ETH Zürich

Data Modeling and Databases Ch 10: Query Processing - Algorithms. Gustavo Alonso Systems Group Department of Computer Science ETH Zürich Data Modeling and Databases Ch 10: Query Processing - Algorithms Gustavo Alonso Systems Group Department of Computer Science ETH Zürich Transactions (Locking, Logging) Metadata Mgmt (Schema, Stats) Application

More information

Chapter 12: Query Processing

Chapter 12: Query Processing Chapter 12: Query Processing Database System Concepts, 6 th Ed. See www.db-book.com for conditions on re-use Overview Chapter 12: Query Processing Measures of Query Cost Selection Operation Sorting Join

More information

CMSC424: Database Design. Instructor: Amol Deshpande

CMSC424: Database Design. Instructor: Amol Deshpande CMSC424: Database Design Instructor: Amol Deshpande amol@cs.umd.edu Databases Data Models Conceptual representa1on of the data Data Retrieval How to ask ques1ons of the database How to answer those ques1ons

More information

Data Modeling and Databases Ch 9: Query Processing - Algorithms. Gustavo Alonso Systems Group Department of Computer Science ETH Zürich

Data Modeling and Databases Ch 9: Query Processing - Algorithms. Gustavo Alonso Systems Group Department of Computer Science ETH Zürich Data Modeling and Databases Ch 9: Query Processing - Algorithms Gustavo Alonso Systems Group Department of Computer Science ETH Zürich Transactions (Locking, Logging) Metadata Mgmt (Schema, Stats) Application

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

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

Introduction Alternative ways of evaluating a given query using

Introduction Alternative ways of evaluating a given query using Query Optimization Introduction Catalog Information for Cost Estimation Estimation of Statistics Transformation of Relational Expressions Dynamic Programming for Choosing Evaluation Plans Introduction

More information

Chapter 12: Query Processing. Chapter 12: Query Processing

Chapter 12: Query Processing. Chapter 12: Query Processing Chapter 12: Query Processing Database System Concepts, 6 th Ed. See www.db-book.com for conditions on re-use Chapter 12: Query Processing Overview Measures of Query Cost Selection Operation Sorting Join

More information

Review. Support for data retrieval at the physical level:

Review. Support for data retrieval at the physical level: Query Processing Review Support for data retrieval at the physical level: Indices: data structures to help with some query evaluation: SELECTION queries (ssn = 123) RANGE queries (100

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

Chapter 13: Query Processing

Chapter 13: Query Processing Chapter 13: Query Processing! Overview! Measures of Query Cost! Selection Operation! Sorting! Join Operation! Other Operations! Evaluation of Expressions 13.1 Basic Steps in Query Processing 1. Parsing

More information

RELATIONAL OPERATORS #1

RELATIONAL OPERATORS #1 RELATIONAL OPERATORS #1 CS 564- Spring 2018 ACKs: Jeff Naughton, Jignesh Patel, AnHai Doan WHAT IS THIS LECTURE ABOUT? Algorithms for relational operators: select project 2 ARCHITECTURE OF A DBMS query

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

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

7. Query Processing and Optimization

7. Query Processing and Optimization 7. Query Processing and Optimization Processing a Query 103 Indexing for Performance Simple (individual) index B + -tree index Matching index scan vs nonmatching index scan Unique index one entry and one

More information

Query Processing. Debapriyo Majumdar Indian Sta4s4cal Ins4tute Kolkata DBMS PGDBA 2016

Query Processing. Debapriyo Majumdar Indian Sta4s4cal Ins4tute Kolkata DBMS PGDBA 2016 Query Processing Debapriyo Majumdar Indian Sta4s4cal Ins4tute Kolkata DBMS PGDBA 2016 Slides re-used with some modification from www.db-book.com Reference: Database System Concepts, 6 th Ed. By Silberschatz,

More information

! A relational algebra expression may have many equivalent. ! Cost is generally measured as total elapsed time for

! A relational algebra expression may have many equivalent. ! Cost is generally measured as total elapsed time for Chapter 13: Query Processing Basic Steps in Query Processing! Overview! Measures of Query Cost! Selection Operation! Sorting! Join Operation! Other Operations! Evaluation of Expressions 1. Parsing and

More information

Chapter 13: Query Processing Basic Steps in Query Processing

Chapter 13: Query Processing Basic Steps in Query Processing Chapter 13: Query Processing Basic Steps in Query Processing! Overview! Measures of Query Cost! Selection Operation! Sorting! Join Operation! Other Operations! Evaluation of Expressions 1. Parsing and

More information

CSC 261/461 Database Systems Lecture 19

CSC 261/461 Database Systems Lecture 19 CSC 261/461 Database Systems Lecture 19 Fall 2017 Announcements CIRC: CIRC is down!!! MongoDB and Spark (mini) projects are at stake. L Project 1 Milestone 4 is out Due date: Last date of class We will

More information

Module 4. Implementation of XQuery. Part 0: Background on relational query processing

Module 4. Implementation of XQuery. Part 0: Background on relational query processing Module 4 Implementation of XQuery Part 0: Background on relational query processing The Data Management Universe Lecture Part I Lecture Part 2 2 What does a Database System do? Input: SQL statement Output:

More information

Query processing and optimization

Query processing and optimization Query processing and optimization These slides are a modified version of the slides of the book Database System Concepts (Chapter 13 and 14), 5th Ed., McGraw-Hill, by Silberschatz, Korth and Sudarshan.

More information

Chapter 14 Query Optimization

Chapter 14 Query Optimization Chapter 14 Query Optimization Chapter 14: Query Optimization! Introduction! Catalog Information for Cost Estimation! Estimation of Statistics! Transformation of Relational Expressions! Dynamic Programming

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

Chapter 14 Query Optimization

Chapter 14 Query Optimization Chapter 14 Query Optimization Chapter 14: Query Optimization! Introduction! Catalog Information for Cost Estimation! Estimation of Statistics! Transformation of Relational Expressions! Dynamic Programming

More information

Chapter 14 Query Optimization

Chapter 14 Query Optimization Chapter 14: Query Optimization Chapter 14 Query Optimization! Introduction! Catalog Information for Cost Estimation! Estimation of Statistics! Transformation of Relational Expressions! Dynamic Programming

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

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

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

Query Processing & Optimization. CS 377: Database Systems

Query Processing & Optimization. CS 377: Database Systems Query Processing & Optimization CS 377: Database Systems Recap: File Organization & Indexing Physical level support for data retrieval File organization: ordered or sequential file to find items using

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

Chapter 11: Query Optimization

Chapter 11: Query Optimization Chapter 11: Query Optimization Chapter 11: Query Optimization Introduction Transformation of Relational Expressions Statistical Information for Cost Estimation Cost-based optimization Dynamic Programming

More information

Advanced Databases. Lecture 4 - Query Optimization. Masood Niazi Torshiz Islamic Azad university- Mashhad Branch

Advanced Databases. Lecture 4 - Query Optimization. Masood Niazi Torshiz Islamic Azad university- Mashhad Branch Advanced Databases Lecture 4 - Query Optimization Masood Niazi Torshiz Islamic Azad university- Mashhad Branch www.mniazi.ir Query Optimization Introduction Transformation of Relational Expressions Catalog

More information

CS222P Fall 2017, Final Exam

CS222P Fall 2017, Final Exam STUDENT NAME: STUDENT ID: CS222P Fall 2017, Final Exam Principles of Data Management Department of Computer Science, UC Irvine Prof. Chen Li (Max. Points: 100 + 15) Instructions: This exam has seven (7)

More information

CSE 544 Principles of Database Management Systems. Alvin Cheung Fall 2015 Lecture 7 - Query optimization

CSE 544 Principles of Database Management Systems. Alvin Cheung Fall 2015 Lecture 7 - Query optimization CSE 544 Principles of Database Management Systems Alvin Cheung Fall 2015 Lecture 7 - Query optimization Announcements HW1 due tonight at 11:45pm HW2 will be due in two weeks You get to implement your own

More information

Query Optimization. Shuigeng Zhou. December 9, 2009 School of Computer Science Fudan University

Query Optimization. Shuigeng Zhou. December 9, 2009 School of Computer Science Fudan University Query Optimization Shuigeng Zhou December 9, 2009 School of Computer Science Fudan University Outline Introduction Catalog Information for Cost Estimation Estimation of Statistics Transformation of Relational

More information

Query optimization. Elena Baralis, Silvia Chiusano Politecnico di Torino. DBMS Architecture D B M G. Database Management Systems. Pag.

Query optimization. Elena Baralis, Silvia Chiusano Politecnico di Torino. DBMS Architecture D B M G. Database Management Systems. Pag. Database Management Systems DBMS Architecture SQL INSTRUCTION OPTIMIZER MANAGEMENT OF ACCESS METHODS CONCURRENCY CONTROL BUFFER MANAGER RELIABILITY MANAGEMENT Index Files Data Files System Catalog DATABASE

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

CSE Midterm - Spring 2017 Solutions

CSE Midterm - Spring 2017 Solutions CSE Midterm - Spring 2017 Solutions March 28, 2017 Question Points Possible Points Earned A.1 10 A.2 10 A.3 10 A 30 B.1 10 B.2 25 B.3 10 B.4 5 B 50 C 20 Total 100 Extended Relational Algebra Operator Reference

More information

Database System Concepts

Database System Concepts Chapter 13: Query Processing s Departamento de Engenharia Informática Instituto Superior Técnico 1 st Semester 2008/2009 Slides (fortemente) baseados nos slides oficiais do livro c Silberschatz, Korth

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

Chapter 3. Algorithms for Query Processing and Optimization

Chapter 3. Algorithms for Query Processing and Optimization Chapter 3 Algorithms for Query Processing and Optimization Chapter Outline 1. Introduction to Query Processing 2. Translating SQL Queries into Relational Algebra 3. Algorithms for External Sorting 4. Algorithms

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

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

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

University of Waterloo Midterm Examination Sample Solution

University of Waterloo Midterm Examination Sample Solution 1. (4 total marks) University of Waterloo Midterm Examination Sample Solution Winter, 2012 Suppose that a relational database contains the following large relation: Track(ReleaseID, TrackNum, Title, Length,

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

CSE 544 Principles of Database Management Systems

CSE 544 Principles of Database Management Systems CSE 544 Principles of Database Management Systems Alvin Cheung Fall 2015 Lecture 6 Lifecycle of a Query Plan 1 Announcements HW1 is due Thursday Projects proposals are due on Wednesday Office hour canceled

More information

Chapter 14: Query Optimization

Chapter 14: Query Optimization Chapter 14: Query Optimization Database System Concepts 5 th Ed. See www.db-book.com for conditions on re-use Chapter 14: Query Optimization Introduction Transformation of Relational Expressions Catalog

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

Spring 2017 EXTERNAL SORTING (CH. 13 IN THE COW BOOK) 2/7/17 CS 564: Database Management Systems; (c) Jignesh M. Patel,

Spring 2017 EXTERNAL SORTING (CH. 13 IN THE COW BOOK) 2/7/17 CS 564: Database Management Systems; (c) Jignesh M. Patel, Spring 2017 EXTERNAL SORTING (CH. 13 IN THE COW BOOK) 2/7/17 CS 564: Database Management Systems; (c) Jignesh M. Patel, 2013 1 Motivation for External Sort Often have a large (size greater than the available

More information

What happens. 376a. Database Design. Execution strategy. Query conversion. Next. Two types of techniques

What happens. 376a. Database Design. Execution strategy. Query conversion. Next. Two types of techniques 376a. Database Design Dept. of Computer Science Vassar College http://www.cs.vassar.edu/~cs376 Class 16 Query optimization What happens Database is given a query Query is scanned - scanner creates a list

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

Hash table example. B+ Tree Index by Example Recall binary trees from CSE 143! Clustered vs Unclustered. Example

Hash table example. B+ Tree Index by Example Recall binary trees from CSE 143! Clustered vs Unclustered. Example Student Introduction to Database Systems CSE 414 Hash table example Index Student_ID on Student.ID Data File Student 10 Tom Hanks 10 20 20 Amy Hanks ID fname lname 10 Tom Hanks 20 Amy Hanks Lecture 26:

More information

DBMS Y3/S5. 1. OVERVIEW The steps involved in processing a query are: 1. Parsing and translation. 2. Optimization. 3. Evaluation.

DBMS Y3/S5. 1. OVERVIEW The steps involved in processing a query are: 1. Parsing and translation. 2. Optimization. 3. Evaluation. Query Processing QUERY PROCESSING refers to the range of activities involved in extracting data from a database. The activities include translation of queries in high-level database languages into expressions

More information

Spring 2017 QUERY PROCESSING [JOINS, SET OPERATIONS, AND AGGREGATES] 2/19/17 CS 564: Database Management Systems; (c) Jignesh M.

Spring 2017 QUERY PROCESSING [JOINS, SET OPERATIONS, AND AGGREGATES] 2/19/17 CS 564: Database Management Systems; (c) Jignesh M. Spring 2017 QUERY PROCESSING [JOINS, SET OPERATIONS, AND AGGREGATES] 2/19/17 CS 564: Database Management Systems; (c) Jignesh M. Patel, 2013 1 Joins The focus here is on equijoins These are very common,

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

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

EECS 647: Introduction to Database Systems

EECS 647: Introduction to Database Systems EECS 647: Introduction to Database Systems Instructor: Luke Huan Spring 2009 External Sorting Today s Topic Implementing the join operation 4/8/2009 Luke Huan Univ. of Kansas 2 Review DBMS Architecture

More information

Plan for today. Query Processing/Optimization. Parsing. A query s trip through the DBMS. Validation. Logical plan

Plan for today. Query Processing/Optimization. Parsing. A query s trip through the DBMS. Validation. Logical plan Plan for today Query Processing/Optimization CPS 216 Advanced Database Systems Overview of query processing Query execution Query plan enumeration Query rewrite heuristics Query rewrite in DB2 2 A query

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

Introduction to Database Systems CSE 414. Lecture 26: More Indexes and Operator Costs

Introduction to Database Systems CSE 414. Lecture 26: More Indexes and Operator Costs Introduction to Database Systems CSE 414 Lecture 26: More Indexes and Operator Costs CSE 414 - Spring 2018 1 Student ID fname lname Hash table example 10 Tom Hanks Index Student_ID on Student.ID Data File

More information

Midterm Review. March 27, 2017

Midterm Review. March 27, 2017 Midterm Review March 27, 2017 1 Overview Relational Algebra & Query Evaluation Relational Algebra Rewrites Index Design / Selection Physical Layouts 2 Relational Algebra & Query Evaluation 3 Relational

More information

Lecture 12. Lecture 12: Access Methods

Lecture 12. Lecture 12: Access Methods Lecture 12 Lecture 12: Access Methods Lecture 12 If you don t find it in the index, look very carefully through the entire catalog - Sears, Roebuck and Co., Consumers Guide, 1897 2 Lecture 12 > Section

More information