CPSC-608 Database Systems

Slides:



Advertisements
Παρόμοιες παρουσιάσεις
Ancient Greek for Everyone: A New Digital Resource for Beginning Greek Unit 4: Conjunctions 2013 edition Wilfred E. Major
Advertisements

Click here to start Important !: You have to enable macros for this game (Tools ->Macros -> Security -> «medium»).
Γειά σας. Say: take a pencil. Πάρε ένα μολύβι. Nick, give me my book.
6 Η ΠΑΡΟΥΣΙΑΣΗ: ΠΑΝΤΕΙΟ ΠΑΝΕΠΙΣΤΗΜΙΟ ΚΟΙΝΩΝΙΚΩΝ ΚΑΙ ΠΟΛΙΤΙΚΩΝ ΕΠΙΣΤΗΜΩΝ ΤΜΗΜΑ: ΕΠΙΚΟΙΝΩΝΙΑΣ, ΜΕΣΩΝ ΚΑΙ ΠΟΛΙΤΙΣΜΟΥ ΜΑΘΗΜΑ: ΕΙΣΑΓΩΓΗ ΣΤΗ ΔΙΑΦΗΜΙΣΗ.
“ Ἡ ἀ γάπη ἀ νυπόκριτος. ἀ ποστυγο ῦ ντες τ ὸ πονηρόν, κολλώμενοι τ ῷ ἀ γαθ ῷ, τ ῇ φιλαδελφί ᾳ ε ἰ ς ἀ λλήλους φιλόστοργοι, τ ῇ τιμ ῇ ἀ λλήλους προηγούμενοι.
Τα ανθρώπινα δικαιώματα 30 είναι τα άρθρα της Οικουμενικής Διακήρυξης των Ανθρωπίνων Δικαιωμάτων που έχουν εκδοθεί ειδικά για τους νέους.
ΗΥ Παπαευσταθίου Γιάννης1 Clock generation.
Τεχνολογία ΛογισμικούSlide 1 Εκτέλεση σε Πραγματικό Χρόνο Τεχνολογία Λογισμικού Slide 25.
6/26/2015HY220: Ιάκωβος Μαυροειδής1 HY220 Asynchronous Circuits.
Week 11 Quiz Sentence #2. The sentence. λαλο ῦ μεν ε ἰ δότες ὅ τι ὁ ἐ γείρας τ ὸ ν κύριον Ἰ ησο ῦ ν κα ὶ ἡ μ ᾶ ς σ ὺ ν Ἰ ησο ῦ ἐ γερε ῖ κα ὶ παραστήσει.
WRITING B LYCEUM Teacher Eleni Rossidou ©Υπουργείο Παιδείας και Πολιτισμού.
COURSE CODE: DES-102 COURSE TITLE: DECORATION DRAWING TUTOR: DOMENICA RENKO SEMESTER: FALL 2010 PROJECT: 2 | hand-out: week 10 – hand-in: week 11 | duration:
Install WINDOWS 7 Κουτσικαρέλης Κων / νος Κουφοκώστας Γεώργιος Κάτσας Παναγιώτης Κουνάνος Ευάγγελος Μ π ουσάη Ελισόν Τάξη Β΄ Τομέας Πληροφορικής 2014 –’15.
Cicadas – the singing insects τζιτζίκια. „Singers” are only the male cicadas Τραγουδιστές είναι μόνο τα αρσενικά τζιτζίκια.
Αριθμητική Επίλυση Διαφορικών Εξισώσεων 1. Συνήθης Δ.Ε. 1 ανεξάρτητη μεταβλητή x 1 εξαρτημένη μεταβλητή y Καθώς και παράγωγοι της y μέχρι n τάξης, στη.
Ψηφιακά Παιχνίδια και μάθηση Δρ. Νικολέτα Γιαννούτσου Εργαστήριο Εκπαιδευτικής Τεχνολογίας.
Διαχείριση Διαδικτυακής Φήμης! Do the Online Reputation Check! «Ημέρα Ασφαλούς Διαδικτύου 2015» Ε. Κοντοπίδη, ΠΕ19.
Guide to Business Planning The Value Chain © Guide to Business Planning A principal use of value chain analysis is to identify a strategy mismatch between.
Guide to Business Planning The Value System © Guide to Business Planning The “value system” is also referred to as the “industry value chain”. In contrast.
Μαθαίνω με “υπότιτλους”
Relations Chapter 9.
«Μαθαίνω» και «Διδάσκω» «Μαθηματικά»
Φάσμα παιδαγωγικής ανάπτυξης
Λ. Μήτρου, Επικ. Καθηγήτρια – Πανεπιστήμιο Αιγαίου Κανονιστικές και Κοινωνικές Διαστάσεις της Κοινωνίας της Πληροφορίας /3 Χειμερινό εξάμηνο
JSIS E 111: Elementary Modern Greek
JSIS E 111: Elementary Modern Greek
Κεφάλαιο 12 Δάση.
Ψηφιακeς ιδEες και αξIες
Υποστηρίζω την άποψη μου επιχειρηματολογώντας
Αλγόριθμοι Ταξινόμησης – Μέρος 3
Class X: Athematic verbs II
ΠΑΝΕΠΙΣΤΗΜΙΟ ΙΩΑΝΝΙΝΩΝ ΑΝΟΙΚΤΑ ΑΚΑΔΗΜΑΪΚΑ ΜΑΘΗΜΑΤΑ
ΠΑΝΕΠΙΣΤΗΜΙΟ ΙΩΑΝΝΙΝΩΝ ΑΝΟΙΚΤΑ ΑΚΑΔΗΜΑΪΚΑ ΜΑΘΗΜΑΤΑ
ΠΑΝΕΠΙΣΤΗΜΙΟ ΙΩΑΝΝΙΝΩΝ ΑΝΟΙΚΤΑ ΑΚΑΔΗΜΑΪΚΑ ΜΑΘΗΜΑΤΑ
JSIS E 111: Elementary Modern Greek
JSIS E 111: Intensive Elementary Modern Greek
ΟΡΓΑΝΩΣΗ ΑΘΛΗΤΙΚΗΣ ΕΓΚΑΤΑΣΤΑΣΗΣ
ΠΑΝΕΠΙΣΤΗΜΙΟ ΙΩΑΝΝΙΝΩΝ ΑΝΟΙΚΤΑ ΑΚΑΔΗΜΑΪΚΑ ΜΑΘΗΜΑΤΑ
Μουσενίκας Δημήτριος Βλάχος Χριστόδουλος
ΠΑΝΕΠΙΣΤΗΜΙΟ ΙΩΑΝΝΙΝΩΝ ΑΝΟΙΚΤΑ ΑΚΑΔΗΜΑΪΚΑ ΜΑΘΗΜΑΤΑ
Εξόρυξη δεδομένων και διαχείριση δεδομένων μεγάλης κλίμακας
(ALPHA BANK – EUROBANK – PIRAEUS BANK)
Οσμές στη Σχεδίαση του Λογισμικού
ECTS-DS Labels Selection 2011 Αθήνα, 28/11/2011
Μία πρακτική εισαγωγή στην χρήση του R
Ανάλυση Γεωργικού Οικογενειακού Εισήματος (ΓΟΕ)
ΥΠΟΥΡΓΕΙΟ ΠΑΙΔΕΙΑΣ ΚΑΙ ΠΟΛΙΤΙΣΜΟΥ
Find: φ σ3 = 400 [lb/ft2] CD test Δσ = 1,000 [lb/ft2] Sand 34˚ 36˚ 38˚
ΗΜΥ-210: Λογικός Σχεδιασμός Εαρινό Εξάμηνο 2005
Θεωρία Παιγνίων: οι Καταλήψεις και οι Τζαμπατζήδες
JSIS E 111: Elementary Modern Greek
aka Mathematical Models and Applications
GLY 326 Structural Geology
ΕΝΣΤΑΣΕΙΣ ΠΟΙΟΣ? Όμως ναι.... Ένα σκάφος
Find: minimum B [ft] γcon=150 [lb/ft3] γT=120 [lb/ft3] Q φ=36˚
ΤΙ ΕΙΝΑΙ ΤΑ ΜΟΆΙ;.
Find: ρc [in] from load γT=110 [lb/ft3] γT=100 [lb/ft3]
Find: σ1 [kPa] for CD test at failure
Βάλια Τόλιου, Registry Manager for Greece
τ [lb/ft2] σ [lb/ft2] Find: c in [lb/ft2] σ1 = 2,000 [lb/ft2]
Financial Market Theory
ΜΕΤΑΦΡΑΣΗ ‘ABC of Selling’. ΤΟ ΑΛΦΑΒΗΤΑΡΙ ΤΩΝ ΠΩΛΗΣΕΩΝ
Find: Force on culvert in [lb/ft]
3Ω 17 V A3 V3.
Deriving the equations of
Find: ρc [in] from load (4 layers)
Εθνικό Μουσείο Σύγχρονης Τέχνης Faceforward … into my home!
Erasmus + An experience with and for refugees Fay Pliagou.
Class X: Athematic verbs II © Dr. Esa Autero
Ο Γαλιλαίος και οι παρατηρήσεις του
Μεταγράφημα παρουσίασης:

CPSC-608 Database Systems Fall 2018 Instructor: Jianer Chen Office: HRBB 315C Phone: 845-4259 Email: chen@cse.tamu.edu Notes #16

parse tree-lqp convertor Query Optimization An input database program P Prepare a collection A of efficient algorithms for operations in relational algebra; parser View processing, Semantic checking parse tree preprocessing parse tree parse tree-lqp convertor logic query plan push selections, group joins apply logic laws logic query plan reduce the size of intermediate results Optimization via logic and size logic query plan Lqp-pqp convertor take care of issues in optimization and security. physical query plan choices of algorithms, data structures, and computational modes Optimization via algorithms and cost Machine executable code

Improving logic plan via logic laws Major Steps: Move selections σ so they can be applied early (σ reduces table size); Combine cross product × with selections σ to make natural joins and theta joins ( has more efficient algorithms); 3. group commutative and associative binary operations (e.g., ∩, U, ) (for later opt.); 4. May consider other operations (e.g., π, δ, τ, γ) C

Improving logic plan via logic laws Major Steps: Move selections σ so they can be applied early (σ reduces table size); Combine cross product × with selections σ to make natural joins and theta joins ( has more efficient algorithms); 3. group commutative and associative binary operations (e.g., ∩, U, ) (for later opt.); 4. May consider other operations (e.g., π, δ, τ, γ) C

Improving logic plan via logic laws Major Steps: Move selections σ so they can be applied early (σ reduces table size); Why is reducing table size important?

Improving logic plan via logic laws Major Steps: Move selections σ so they can be applied early (σ reduces table size); Why is reducing table size important? Tables are large, the intermediate tables can be even larger, so they may have to be written back to disks. Reducing table size will save, or even avoid disk reads/writes.

Improving logic plan via logic laws σC(R⋃S) = σC(R)⋃σC(S) σC(R∩S) = σC(R)∩σC(S) = σC(R)∩S = R∩σC(S) σC(RS) = σC(R)  σC(S) = σC(R)  S ╳, ⨝, ⨝D: σC can only be pushed to the arguments that have all attributes in C. σC and D(R) = σC(σD(R)) = σD(σC(R))

Improving logic plan via logic laws σC(R⋃S) = σC(R)⋃σC(S) σC(R∩S) = σC(R)∩σC(S) = σC(R)∩S = R∩σC(S) σC(RS) = σC(R)  σC(S) = σC(R)  S ╳, ⨝, ⨝D: σC can only be pushed to the arguments that has all attributes in C. σC and D(R) = σC(σD(R)) = σD(σC(R))

Improving logic plan via logic laws σC(R⋃S) = σC(R)⋃σC(S) σC(R∩S) = σC(R)∩σC(S) = σC(R)∩S = R∩σC(S) σC(RS) = σC(R)  σC(S) = σC(R)  S ╳, ⨝, ⨝D: σC can only be pushed to the arguments that has all attributes in C. σC and D(R) = σC(σD(R)) = σD(σC(R)) Take the tuples that are either in R or in S and satisfy the condition C

Improving logic plan via logic laws σC(R⋃S) = σC(R)⋃σC(S) σC(R∩S) = σC(R)∩σC(S) = σC(R)∩S = R∩σC(S) σC(RS) = σC(R)  σC(S) = σC(R)  S ╳, ⨝, ⨝D: σC can only be pushed to the arguments that has all attributes in C. σC and D(R) = σC(σD(R)) = σD(σC(R)) Take the tuples that are either in R or in S and satisfy the condition C Take the tuples that are either in R and satisfy the condition C or in U and satisfy the condition C

Improving logic plan via logic laws σC(R⋃S) = σC(R)⋃σC(S) σC(R∩S) = σC(R)∩σC(S) = σC(R)∩S = R∩σC(S) σC(RS) = σC(R)  σC(S) = σC(R)  S ╳, ⨝, ⨝D: σC can only be pushed to the arguments that has all attributes in C. σC and D(R) = σC(σD(R)) = σD(σC(R)) Take the tuples that are either in R or in S and satisfy the condition C Take the tuples that are either in R and satisfy the condition C or in U and satisfy the condition C

Improving logic plan via logic laws σC(R⋃S) = σC(R)⋃σC(S) σC(R∩S) = σC(R)∩σC(S) = σC(R)∩S = R∩σC(S) σC(RS) = σC(R)  σC(S) = σC(R)  S ╳, ⨝, ⨝D: σC can only be pushed to the arguments that has all attributes in C. σC and D(R) = σC(σD(R)) = σD(σC(R)) R(a,b) S(b,d)   σ C ⋃ σ C σ C R(a,b) S(b,d) Take the tuples that are either in R or in S and satisfy the condition C Take the tuples that are either in R and satisfy the condition C or in U and satisfy the condition C

Improving logic plan via logic laws σC(R⋃S) = σC(R)⋃σC(S) σC(R∩S) = σC(R)∩σC(S) = σC(R)∩S = R∩σC(S) σC(RS) = σC(R)  σC(S) = σC(R)  S ╳, ⨝, ⨝D: σC can only be pushed to the arguments that has all attributes in C. σC and D(R) = σC(σD(R)) = σD(σC(R)) R(a,b) S(b,d)   σ C ⋃ 100 100 σ C σ C R(a,b) S(b,d) 10000 20000 10000 20000 Take the tuples that are either in R or in S and satisfy the condition C Take the tuples that are either in R and satisfy the condition C or in U and satisfy the condition C

Improving logic plan via logic laws σC(R⋃S) = σC(R)⋃σC(S) σC(R∩S) = σC(R)∩σC(S) = σC(R)∩S = R∩σC(S) σC(RS) = σC(R)  σC(S) = σC(R)  S ╳, ⨝, ⨝D: σC can only be pushed to the arguments that has all attributes in C. σC and D(R) = σC(σD(R)) = σD(σC(R)) R(a,b) S(b,d)   σ C ⋃ 100 100 σ C σ C 25000 R(a,b) S(b,d) 10000 20000 10000 20000 Take the tuples that are either in R or in S and satisfy the condition C Take the tuples that are either in R and satisfy the condition C or in U and satisfy the condition C

Improving logic plan via logic laws σC(R⋃S) = σC(R)⋃σC(S) σC(R∩S) = σC(R)∩σC(S) = σC(R)∩S = R∩σC(S) σC(RS) = σC(R)  σC(S) = σC(R)  S ╳, ⨝, ⨝D: σC can only be pushed to the arguments that has all attributes in C. σC and D(R) = σC(σD(R)) = σD(σC(R)) R(a,b) S(b,d)   σ C ⋃ 100 100 σ C σ C 45 80 25000 R(a,b) S(b,d) 20000 10000 20000 10000 Take the tuples that are either in R or in S and satisfy the condition C Take the tuples that are either in R and satisfy the condition C or in U and satisfy the condition C

Improving logic plan via logic laws σC(R⋃S) = σC(R)⋃σC(S) σC(R∩S) = σC(R)∩σC(S) = σC(R)∩S = R∩σC(S) σC(RS) = σC(R)  σC(S) = σC(R)  S ╳, ⨝, ⨝D: σC can only be pushed to the arguments that has all attributes in C. σC and D(R) = σC(σD(R)) = σD(σC(R)) R(a,b) S(b,d)   σ C ⋃ 100 100 σ C σ C 45 80 25000 R(a,b) S(b,d) 20000 10000 20000 10000 Take the tuples that are either in R or in S and satisfy the condition C Take the tuples that are either in R and satisfy the condition C or in U and satisfy the condition C

Improving logic plan via logic laws σC(R⋃S) = σC(R)⋃σC(S) σC(R∩S) = σC(R)∩σC(S) = σC(R)∩S = R∩σC(S) σC(RS) = σC(R)  σC(S) = σC(R)  S ╳, ⨝, ⨝D: σC can only be pushed to the arguments that have all attributes in C. σC and D(R) = σC(σD(R)) = σD(σC(R))

Improving logic plan via logic laws σC(R⋃S) = σC(R)⋃σC(S) σC(R∩S) = σC(R)∩σC(S) = σC(R)∩S = R∩σC(S) σC(RS) = σC(R)  σC(S) = σC(R)  S ╳, ⨝, ⨝D: σC can only be pushed to the arguments that have all attributes in C. σC and D(R) = σC(σD(R)) = σD(σC(R)) The correctness can be similarly proved

Improving logic plan via logic laws σC(R⋃S) = σC(R)⋃σC(S) σC(R∩S) = σC(R)∩σC(S) = σC(R)∩S = R∩σC(S) σC(RS) = σC(R)  σC(S) = σC(R)  S ╳, ⨝, ⨝D: σC can only be pushed to the arguments that have all attributes in C. σC and D(R) = σC(σD(R)) = σD(σC(R)) The correctness can be similarly proved tuples that are in R but not in S and satisfy the condition C

Improving logic plan via logic laws σC(R⋃S) = σC(R)⋃σC(S) σC(R∩S) = σC(R)∩σC(S) = σC(R)∩S = R∩σC(S) σC(RS) = σC(R)  σC(S) = σC(R)  S ╳, ⨝, ⨝D: σC can only be pushed to the arguments that have all attributes in C. σC and D(R) = σC(σD(R)) = σD(σC(R)) The correctness can be similarly proved tuples that are in R but not in S and satisfy the condition C tuples that are in R and satisfy the condition C but are not in S

Improving logic plan via logic laws σC(R⋃S) = σC(R)⋃σC(S) σC(R∩S) = σC(R)∩σC(S) = σC(R)∩S = R∩σC(S) σC(RS) = σC(R)  σC(S) = σC(R)  S ╳, ⨝, ⨝D: σC can only be pushed to the arguments that have all attributes in C. σC and D(R) = σC(σD(R)) = σD(σC(R)) Again pushing the selection σC reduces the size of the intermediate relations

Improving logic plan via logic laws σC(R⋃S) = σC(R)⋃σC(S) σC(R∩S) = σC(R)∩σC(S) = σC(R)∩S = R∩σC(S) σC(RS) = σC(R)  σC(S) = σC(R)  S ╳, ⨝, ⨝D: σC can only be pushed to the arguments that have all attributes in C. σC and D(R) = σC(σD(R)) = σD(σC(R)) Remarks.

Improving logic plan via logic laws σC(R⋃S) = σC(R)⋃σC(S) σC(R∩S) = σC(R)∩σC(S) = σC(R)∩S = R∩σC(S) σC(RS) = σC(R)  σC(S) = σC(R)  S ╳, ⨝, ⨝D: σC can only be pushed to the arguments that have all attributes in C. σC and D(R) = σC(σD(R)) = σD(σC(R)) Remarks. 1. Set/bag operations are applied on relations of the same schema, so the condition C in σC are applicable on both arguments;

Improving logic plan via logic laws σC(R⋃S) = σC(R)⋃σC(S) σC(R∩S) = σC(R)∩σC(S) = σC(R)∩S = R∩σC(S) σC(RS) = σC(R)  σC(S) = σC(R)  S ╳, ⨝, ⨝D: σC can only be pushed to the arguments that have all attributes in C. σC and D(R) = σC(σD(R)) = σD(σC(R)) Remarks. 1. Set/bag operations are applied on relations of the same schema, so the condition C in σC are applicable on both arguments; 2. The condition C may be pushed to only one argument;

Improving logic plan via logic laws σC(R⋃S) = σC(R)⋃σC(S) σC(R∩S) = σC(R)∩σC(S) = σC(R)∩S = R∩σC(S) σC(RS) = σC(R)  σC(S) = σC(R)  S ╳, ⨝, ⨝D: σC can only be pushed to the arguments that have all attributes in C. σC and D(R) = σC(σD(R)) = σD(σC(R)) Remarks. 1. Set/bag operations are applied on relations of the same schema, so the condition C in σC are applicable on both arguments; 2. The condition C may be pushed to only one argument; 3. σC(R⋃S) = R⋃σC(S), σC(R⋃S) = σC(R)⋃S, and σC(RS) = RσC(S) are NOT valid

Improving logic plan via logic laws σC(R⋃S) = σC(R)⋃σC(S) σC(R∩S) = σC(R)∩σC(S) = σC(R)∩S = R∩σC(S) σC(RS) = σC(R)  σC(S) = σC(R)  S ╳, ⨝, ⨝D: σC can only be pushed to the arguments that have all attributes in C. σC and D(R) = σC(σD(R)) = σD(σC(R))

Improving logic plan via logic laws σC(R⋃S) = σC(R)⋃σC(S) σC(R∩S) = σC(R)∩σC(S) = σC(R)∩S = R∩σC(S) σC(RS) = σC(R)  σC(S) = σC(R)  S ╳, ⨝, ⨝D: σC can only be pushed to the arguments that have all attributes in C. σC and D(R) = σC(σD(R)) = σD(σC(R)) Pushing the selection may not even be meaningful

Improving logic plan via logic laws σC(R⋃S) = σC(R)⋃σC(S) σC(R∩S) = σC(R)∩σC(S) = σC(R)∩S = R∩σC(S) σC(RS) = σC(R)  σC(S) = σC(R)  S ╳, ⨝, ⨝D: σC can only be pushed to the arguments that have all attributes in C. σC and D(R) = σC(σD(R)) = σD(σC(R)) Pushing the selection may not even be meaningful S(a,b) T(b,d) c × π σ S.a=T.d

Improving logic plan via logic laws σC(R⋃S) = σC(R)⋃σC(S) σC(R∩S) = σC(R)∩σC(S) = σC(R)∩S = R∩σC(S) σC(RS) = σC(R)  σC(S) = σC(R)  S ╳, ⨝, ⨝D: σC can only be pushed to the arguments that have all attributes in C. σC and D(R) = σC(σD(R)) = σD(σC(R)) Pushing the selection may not even be meaningful S(a,b) T(b,d) c × π σ S.a=T.d π c × σ S.a=T.d σ S.a=T.d S(a,b) T(b,d)

Improving logic plan via logic laws σC(R⋃S) = σC(R)⋃σC(S) σC(R∩S) = σC(R)∩σC(S) = σC(R)∩S = R∩σC(S) σC(RS) = σC(R)  σC(S) = σC(R)  S ╳, ⨝, ⨝D: σC can only be pushed to the arguments that have all attributes in C. σC and D(R) = σC(σD(R)) = σD(σC(R)) Pushing the selection may not even be meaningful S(a,b) T(b,d) c × π σ S.a=T.d π c × σ S.a=T.d σ S.a=T.d ?? S(a,b) T(b,d)

Improving logic plan via logic laws σC(R⋃S) = σC(R)⋃σC(S) σC(R∩S) = σC(R)∩σC(S) = σC(R)∩S = R∩σC(S) σC(RS) = σC(R)  σC(S) = σC(R)  S ╳, ⨝, ⨝D: σC can only be pushed to the arguments that have all attributes in C. σC and D(R) = σC(σD(R)) = σD(σC(R)) Even when it is syntactically meaningful, it may not be logically correct.

Improving logic plan via logic laws σC(R⋃S) = σC(R)⋃σC(S) σC(R∩S) = σC(R)∩σC(S) = σC(R)∩S = R∩σC(S) σC(RS) = σC(R)  σC(S) = σC(R)  S ╳, ⨝, ⨝D: σC can only be pushed to the arguments that have all attributes in C. σC and D(R) = σC(σD(R)) = σD(σC(R)) Even when it is syntactically meaningful, it may not be logically correct. R(a,b) S(b,c) a b 5 yes … b c yes 4 …

Improving logic plan via logic laws σC(R⋃S) = σC(R)⋃σC(S) σC(R∩S) = σC(R)∩σC(S) = σC(R)∩S = R∩σC(S) σC(RS) = σC(R)  σC(S) = σC(R)  S ╳, ⨝, ⨝D: σC can only be pushed to the arguments that have all attributes in C. σC and D(R) = σC(σD(R)) = σD(σC(R)) Even when it is syntactically meaningful, it may not be logically correct. R(a,b) S(b,c) 5 yes 4 a b 5 yes … b c yes 4 … in σa=5 or c=3(R ⨝ S) but may not be in σa=5(R) ⨝ σc=3(S)

Improving logic plan via logic laws σC(R⋃S) = σC(R)⋃σC(S) σC(R∩S) = σC(R)∩σC(S) = σC(R)∩S = R∩σC(S) σC(RS) = σC(R)  σC(S) = σC(R)  S ╳, ⨝, ⨝D: σC can only be pushed to the arguments that have all attributes in C. σC and D(R) = σC(σD(R)) = σD(σC(R)) We need a formal proof for the validity of each rule

Improving logic plan via logic laws Theorem. If C contains only attributes in R, then σC(R⨝S) = σC(R)⨝S σC(R⋃S) = σC(R)⋃σC(S) σC(R∩S) = σC(R)∩σC(S) = σC(R)∩S = R∩σC(S) σC(RS) = σC(R)  σC(S) = σC(R)  S ╳, ⨝, ⨝D: σC can only be pushed to the arguments that have all attributes in C. σC and D(R) = σC(σD(R)) = σD(σC(R)) We need a formal proof for the validity of each rule

Improving logic plan via logic laws Theorem. If C contains only attributes in R, then σC(R⨝S) = σC(R)⨝S σC(R⋃S) = σC(R)⋃σC(S) σC(R∩S) = σC(R)∩σC(S) = σC(R)∩S = R∩σC(S) σC(RS) = σC(R)  σC(S) = σC(R)  S ╳, ⨝, ⨝D: σC can only be pushed to the arguments that have all attributes in C. σC and D(R) = σC(σD(R)) = σD(σC(R)) Proof. Let t be in σC(R⨝S). Then t is a join of a tuple t1 in R and a tuple t2 in S such that t1 and t2 agree on the common attributes. Since C contains only attributes in R and t satisfies C, t1 must also satisfy C, i.e., t1 is in σC(R). Thus, t is a join of t1 in σC(R) and t2 in S, i.e., t is in σC(R)⨝S. Thus, all tuples t in σC(R⨝S) are in σC(R)⨝S. Now consider a tuple t in σC(R)⨝S. t is a join of a tuple t1 in σC(R) and a tuple t2 in S such that t1 and t2 agree on the common attributes, and t1 satisfies C. Since t1 is in R so t is in R⨝S. Since t1 satisfies C, t also satisfies C, i.e., t is in σC(R⨝S). Thus, all tuples t in σC(R)⨝S are in σC(R⨝S). Thus, we must have σC(R⨝S) = σC(R)⨝S. ⃞

Improving logic plan via logic laws Theorem. If C contains only attributes in R, then σC(R⨝S) = σC(R)⨝S σC(R⋃S) = σC(R)⋃σC(S) σC(R∩S) = σC(R)∩σC(S) = σC(R)∩S = R∩σC(S) σC(RS) = σC(R)  σC(S) = σC(R)  S ╳, ⨝, ⨝D: σC can only be pushed to the arguments that have all attributes in C. σC and D(R) = σC(σD(R)) = σD(σC(R)) Proof. Let t be in σC(R⨝S). Then t is a join of a tuple t1 in R and a tuple t2 in S such that t1 and t2 agree on the common attributes. Since C contains only attributes in R and t satisfies C, t1 must also satisfy C, i.e., t1 is in σC(R). Thus, t is a join of t1 in σC(R) and t2 in S, i.e., t is in σC(R)⨝S. Thus, all tuples t in σC(R⨝S) are in σC(R)⨝S. Now consider a tuple t in σC(R)⨝S. t is a join of a tuple t1 in σC(R) and a tuple t2 in S such that t1 and t2 agree on the common attributes, and t1 satisfies C. Since t1 is in R so t is in R⨝S. Since t1 satisfies C, t also satisfies C, i.e., t is in σC(R⨝S). Thus, all tuples t in σC(R)⨝S are in σC(R⨝S). Thus, we must have σC(R⨝S) = σC(R)⨝S. ⃞

Improving logic plan via logic laws Theorem. If C contains only attributes in R, then σC(R⨝S) = σC(R)⨝S σC(R⋃S) = σC(R)⋃σC(S) σC(R∩S) = σC(R)∩σC(S) = σC(R)∩S = R∩σC(S) σC(RS) = σC(R)  σC(S) = σC(R)  S ╳, ⨝, ⨝D: σC can only be pushed to the arguments that have all attributes in C. σC and D(R) = σC(σD(R)) = σD(σC(R)) Proof. Let t be in σC(R⨝S). Then t is a join of a tuple t1 in R and a tuple t2 in S such that t1 and t2 agree on the common attributes. Since C contains only attributes in R and t satisfies C, t1 must also satisfy C, i.e., t1 is in σC(R). Thus, t is a join of t1 in σC(R) and t2 in S, i.e., t is in σC(R)⨝S. Thus, all tuples t in σC(R⨝S) are in σC(R)⨝S. Now consider a tuple t in σC(R)⨝S. t is a join of a tuple t1 in σC(R) and a tuple t2 in S such that t1 and t2 agree on the common attributes, and t1 satisfies C. Since t1 is in R so t is in R⨝S. Since t1 satisfies C, t also satisfies C, i.e., t is in σC(R⨝S). Thus, all tuples t in σC(R)⨝S are in σC(R⨝S). Thus, we must have σC(R⨝S) = σC(R)⨝S. ⃞

Improving logic plan via logic laws Theorem. If C contains only attributes in R, then σC(R⨝S) = σC(R)⨝S σC(R⋃S) = σC(R)⋃σC(S) σC(R∩S) = σC(R)∩σC(S) = σC(R)∩S = R∩σC(S) σC(RS) = σC(R)  σC(S) = σC(R)  S ╳, ⨝, ⨝D: σC can only be pushed to the arguments that have all attributes in C. σC and D(R) = σC(σD(R)) = σD(σC(R)) Proof. Let t be in σC(R⨝S). Then t is a join of a tuple t1 in R and a tuple t2 in S such that t1 and t2 agree on the common attributes. Since C contains only attributes in R and t satisfies C, t1 must also satisfy C, i.e., t1 is in σC(R). Thus, t is a join of t1 in σC(R) and t2 in S, i.e., t is in σC(R)⨝S. Thus, all tuples t in σC(R⨝S) are in σC(R)⨝S. Now consider a tuple t in σC(R)⨝S. t is a join of a tuple t1 in σC(R) and a tuple t2 in S such that t1 and t2 agree on the common attributes, and t1 satisfies C. Since t1 is in R so t is in R⨝S. Since t1 satisfies C, t also satisfies C, i.e., t is in σC(R⨝S). Thus, all tuples t in σC(R)⨝S are in σC(R⨝S). Thus, we must have σC(R⨝S) = σC(R)⨝S. ⃞

Improving logic plan via logic laws Theorem. If C contains only attributes in R, then σC(R⨝S) = σC(R)⨝S σC(R⋃S) = σC(R)⋃σC(S) σC(R∩S) = σC(R)∩σC(S) = σC(R)∩S = R∩σC(S) σC(RS) = σC(R)  σC(S) = σC(R)  S ╳, ⨝, ⨝D: σC can only be pushed to the arguments that have all attributes in C. σC and D(R) = σC(σD(R)) = σD(σC(R)) Proof. Let t be in σC(R⨝S). Then t is a join of a tuple t1 in R and a tuple t2 in S such that t1 and t2 agree on the common attributes. Since C contains only attributes in R and t satisfies C, t1 must also satisfy C, i.e., t1 is in σC(R). Thus, t is a join of t1 in σC(R) and t2 in S, i.e., t is in σC(R)⨝S. Thus, all tuples t in σC(R⨝S) are in σC(R)⨝S. Now consider a tuple t in σC(R)⨝S. t is a join of a tuple t1 in σC(R) and a tuple t2 in S such that t1 and t2 agree on the common attributes, and t1 satisfies C. Since t1 is in R so t is in R⨝S. Since t1 satisfies C, t also satisfies C, i.e., t is in σC(R⨝S). Thus, all tuples t in σC(R)⨝S are in σC(R⨝S). Thus, we must have σC(R⨝S) = σC(R)⨝S. ⃞

Improving logic plan via logic laws Theorem. If C contains only attributes in R, then σC(R⨝S) = σC(R)⨝S σC(R⋃S) = σC(R)⋃σC(S) σC(R∩S) = σC(R)∩σC(S) = σC(R)∩S = R∩σC(S) σC(RS) = σC(R)  σC(S) = σC(R)  S ╳, ⨝, ⨝D: σC can only be pushed to the arguments that have all attributes in C. σC and D(R) = σC(σD(R)) = σD(σC(R)) Proof. Let t be in σC(R⨝S). Then t is a join of a tuple t1 in R and a tuple t2 in S such that t1 and t2 agree on the common attributes. Since C contains only attributes in R and t satisfies C, t1 must also satisfy C, i.e., t1 is in σC(R). Thus, t is a join of t1 in σC(R) and t2 in S, i.e., t is in σC(R)⨝S. Thus, all tuples t in σC(R⨝S) are in σC(R)⨝S. Now consider a tuple t in σC(R)⨝S. t is a join of a tuple t1 in σC(R) and a tuple t2 in S such that t1 and t2 agree on the common attributes, and t1 satisfies C. Since t1 is in R so t is in R⨝S. Since t1 satisfies C, t also satisfies C, i.e., t is in σC(R⨝S). Thus, all tuples t in σC(R)⨝S are in σC(R⨝S). Thus, we must have σC(R⨝S) = σC(R)⨝S. ⃞

Improving logic plan via logic laws Theorem. If C contains only attributes in R, then σC(R⨝S) = σC(R)⨝S σC(R⋃S) = σC(R)⋃σC(S) σC(R∩S) = σC(R)∩σC(S) = σC(R)∩S = R∩σC(S) σC(RS) = σC(R)  σC(S) = σC(R)  S ╳, ⨝, ⨝D: σC can only be pushed to the arguments that have all attributes in C. σC and D(R) = σC(σD(R)) = σD(σC(R)) Proof. Let t be in σC(R⨝S). Then t is a join of a tuple t1 in R and a tuple t2 in S such that t1 and t2 agree on the common attributes. Since C contains only attributes in R and t satisfies C, t1 must also satisfy C, i.e., t1 is in σC(R). Thus, t is a join of t1 in σC(R) and t2 in S, i.e., t is in σC(R)⨝S. Thus, all tuples t in σC(R⨝S) are in σC(R)⨝S. Now consider a tuple t in σC(R)⨝S. t is a join of a tuple t1 in σC(R) and a tuple t2 in S such that t1 and t2 agree on the common attributes, and t1 satisfies C. Since t1 is in R so t is in R⨝S. Since t1 satisfies C, t also satisfies C, i.e., t is in σC(R⨝S). Thus, all tuples t in σC(R)⨝S are in σC(R⨝S). Thus, we must have σC(R⨝S) = σC(R)⨝S. ⃞

Improving logic plan via logic laws Theorem. If C contains only attributes in R, then σC(R⨝S) = σC(R)⨝S σC(R⋃S) = σC(R)⋃σC(S) σC(R∩S) = σC(R)∩σC(S) = σC(R)∩S = R∩σC(S) σC(RS) = σC(R)  σC(S) = σC(R)  S ╳, ⨝, ⨝D: σC can only be pushed to the arguments that have all attributes in C. σC and D(R) = σC(σD(R)) = σD(σC(R)) Proof. Let t be in σC(R⨝S). Then t is a join of a tuple t1 in R and a tuple t2 in S such that t1 and t2 agree on the common attributes. Since C contains only attributes in R and t satisfies C, t1 must also satisfy C, i.e., t1 is in σC(R). Thus, t is a join of t1 in σC(R) and t2 in S, i.e., t is in σC(R)⨝S. Thus, all tuples t in σC(R⨝S) are in σC(R)⨝S. Now consider a tuple t in σC(R)⨝S. t is a join of a tuple t1 in σC(R) and a tuple t2 in S such that t1 and t2 agree on the common attributes, and t1 satisfies C. Since t1 is in R so t is in R⨝S. Since t1 satisfies C, t also satisfies C, i.e., t is in σC(R⨝S). Thus, all tuples t in σC(R)⨝S are in σC(R⨝S). Thus, we must have σC(R⨝S) = σC(R)⨝S. ⃞

Improving logic plan via logic laws Theorem. If C contains only attributes in R, then σC(R⨝S) = σC(R)⨝S σC(R⋃S) = σC(R)⋃σC(S) σC(R∩S) = σC(R)∩σC(S) = σC(R)∩S = R∩σC(S) σC(RS) = σC(R)  σC(S) = σC(R)  S ╳, ⨝, ⨝D: σC can only be pushed to the arguments that have all attributes in C. σC and D(R) = σC(σD(R)) = σD(σC(R)) Proof. Let t be in σC(R⨝S). Then t is a join of a tuple t1 in R and a tuple t2 in S such that t1 and t2 agree on the common attributes. Since C contains only attributes in R and t satisfies C, t1 must also satisfy C, i.e., t1 is in σC(R). Thus, t is a join of t1 in σC(R) and t2 in S, i.e., t is in σC(R)⨝S. Thus, all tuples t in σC(R⨝S) are in σC(R)⨝S. Now consider a tuple t in σC(R)⨝S. t is a join of a tuple t1 in σC(R) and a tuple t2 in S such that t1 and t2 agree on the common attributes, and t1 satisfies C. Since t1 is in R so t is in R⨝S. Since t1 satisfies C, t also satisfies C, i.e., t is in σC(R⨝S). Thus, all tuples t in σC(R)⨝S are in σC(R⨝S). Thus, we must have σC(R⨝S) = σC(R)⨝S. ⃞

Improving logic plan via logic laws Theorem. If C contains only attributes in R, then σC(R⨝S) = σC(R)⨝S σC(R⋃S) = σC(R)⋃σC(S) σC(R∩S) = σC(R)∩σC(S) = σC(R)∩S = R∩σC(S) σC(RS) = σC(R)  σC(S) = σC(R)  S ╳, ⨝, ⨝D: σC can only be pushed to the arguments that have all attributes in C. σC and D(R) = σC(σD(R)) = σD(σC(R)) Proof. Let t be in σC(R⨝S). Then t is a join of a tuple t1 in R and a tuple t2 in S such that t1 and t2 agree on the common attributes. Since C contains only attributes in R and t satisfies C, t1 must also satisfy C, i.e., t1 is in σC(R). Thus, t is a join of t1 in σC(R) and t2 in S, i.e., t is in σC(R)⨝S. Thus, all tuples t in σC(R⨝S) are in σC(R)⨝S. Now consider a tuple t in σC(R)⨝S. t is a join of a tuple t1 in σC(R) and a tuple t2 in S such that t1 and t2 agree on the common attributes, and t1 satisfies C. Since t1 is in R so t is in R⨝S. Since t1 satisfies C, t also satisfies C, i.e., t is in σC(R⨝S). Thus, all tuples t in σC(R)⨝S are in σC(R⨝S). Thus, we must have σC(R⨝S) = σC(R)⨝S. ⃞

Improving logic plan via logic laws Theorem. If C contains only attributes in R, then σC(R⨝S) = σC(R)⨝S σC(R⋃S) = σC(R)⋃σC(S) σC(R∩S) = σC(R)∩σC(S) = σC(R)∩S = R∩σC(S) σC(RS) = σC(R)  σC(S) = σC(R)  S ╳, ⨝, ⨝D: σC can only be pushed to the arguments that have all attributes in C. σC and D(R) = σC(σD(R)) = σD(σC(R)) Proof. Let t be in σC(R⨝S). Then t is a join of a tuple t1 in R and a tuple t2 in S such that t1 and t2 agree on the common attributes. Since C contains only attributes in R and t satisfies C, t1 must also satisfy C, i.e., t1 is in σC(R). Thus, t is a join of t1 in σC(R) and t2 in S, i.e., t is in σC(R)⨝S. Thus, all tuples t in σC(R⨝S) are in σC(R)⨝S. Now consider a tuple t in σC(R)⨝S. t is a join of a tuple t1 in σC(R) and a tuple t2 in S such that t1 and t2 agree on the common attributes, and t1 satisfies C. Since t1 is in R so t is in R⨝S. Since t1 satisfies C, t also satisfies C, i.e., t is in σC(R⨝S). Thus, all tuples t in σC(R)⨝S are in σC(R⨝S). Thus, we must have σC(R⨝S) = σC(R)⨝S. ⃞

Improving logic plan via logic laws Theorem. If C contains only attributes in R, then σC(R⨝S) = σC(R)⨝S σC(R⋃S) = σC(R)⋃σC(S) σC(R∩S) = σC(R)∩σC(S) = σC(R)∩S = R∩σC(S) σC(RS) = σC(R)  σC(S) = σC(R)  S ╳, ⨝, ⨝D: σC can only be pushed to the arguments that have all attributes in C. σC and D(R) = σC(σD(R)) = σD(σC(R)) Proof. Let t be in σC(R⨝S). Then t is a join of a tuple t1 in R and a tuple t2 in S such that t1 and t2 agree on the common attributes. Since C contains only attributes in R and t satisfies C, t1 must also satisfy C, i.e., t1 is in σC(R). Thus, t is a join of t1 in σC(R) and t2 in S, i.e., t is in σC(R)⨝S. Thus, all tuples t in σC(R⨝S) are in σC(R)⨝S. Now consider a tuple t in σC(R)⨝S. t is a join of a tuple t1 in σC(R) and a tuple t2 in S such that t1 and t2 agree on the common attributes, and t1 satisfies C. Since t1 is in R so t is in R⨝S. Since t1 satisfies C, t also satisfies C, i.e., t is in σC(R⨝S). Thus, all tuples t in σC(R)⨝S are in σC(R⨝S). Thus, we must have σC(R⨝S) = σC(R)⨝S. ⃞

Improving logic plan via logic laws σC(R⋃S) = σC(R)⋃σC(S) σC(R∩S) = σC(R)∩σC(S) = σC(R)∩S = R∩σC(S) σC(RS) = σC(R)  σC(S) = σC(R)  S ╳, ⨝, ⨝D: σC can only be pushed to the arguments that have all attributes in C. σC and D(R) = σC(σD(R)) = σD(σC(R))

Improving logic plan via logic laws σC(R⋃S) = σC(R)⋃σC(S) σC(R∩S) = σC(R)∩σC(S) = σC(R)∩S = R∩σC(S) σC(RS) = σC(R)  σC(S) = σC(R)  S ╳, ⨝, ⨝D: σC can only be pushed to the arguments that have all attributes in C. σC and D(R) = σC(σD(R)) = σD(σC(R)) Can be trivially proved

Improving logic plan via logic laws σC(R⋃S) = σC(R)⋃σC(S) σC(R∩S) = σC(R)∩σC(S) = σC(R)∩S = R∩σC(S) σC(RS) = σC(R)  σC(S) = σC(R)  S ╳, ⨝, ⨝D: σC can only be pushed to the arguments that have all attributes in C. σC and D(R) = σC(σD(R)) = σD(σC(R)) Can be trivially proved Useful when you want to further push some of the selections down.

Improving logic plan via logic laws S(a,b) T(b,d) c × π σ S.b=T.b & d>4

Improving logic plan via logic laws S(a,b) T(b,d) × c π σ d>4 S.b=T.b S(a,b) T(b,d) c × π σ S.b=T.b & d>4 σC&D(R) = σC(σD(R))

Improving logic plan via logic laws S(a,b) T(b,d) × c π σ d>4 S.b=T.b S(a,b) T(b,d) c × π σ S.b=T.b & d>4 σC&D(R) = σC(σD(R)) σC(R×S) = R×σC(S) S(a,b) T(b,d) × c π σ S.b=T.b d>4

Improving logic plan via logic laws S(a,b) T(b,d) × c π σ d>4 S.b=T.b S(a,b) T(b,d) c × π σ S.b=T.b & d>4 σC&D(R) = σC(σD(R)) σC(R×S) = R×σC(S) S(a,b) T(b,d) c π σ d>4 S(a,b) T(b,d) × c π σ S.b=T.b d>4 σS.b=T.b(S×T) = S T

Improving logic plan via logic laws Major Steps: Move selections σ so they can be applied early (σ reduces table size); Combine cross product × with selections σ to make natural joins and theta joins C ( has more efficient algorithms); 3. group commutative and associative binary operations (e.g., ∩, U, ) (for later opt.); 4. May consider other operations (e.g., π, δ, τ, γ)