Traditional Query Processing. Query Processing. Meta-Data for Optimization. Query Optimization Steps. Algebraic Transformation Predicate Pushdown
|
|
- Chester McDowell
- 6 years ago
- Views:
Transcription
1 Traditional Query Processing 1. Query optimization buyer Query Processing Be Adaptive SELECT S.s FROM Purchase P, Person Q WHERE P.buyer=Q. AND Q.city= seattle AND Q.phone > Query execution σ City= seattle phone> Buyer= (Simple Nested Loops) Purchase Person (Table scan) (Index scan) Meta-Data for Optimization Sizes of tables in the database Selectivity information: How many rows per value in a column How many rows per range Cardinality of certain views Indexes on the data: B-trees, hash indices, sorting order Query Optimization Steps Algebraic transformations Can be very complex Select ordering of joins Many possible orders. Can t explore them all Select algorithm for each node in the query plan Many possible implementations of relational operators Algebraic Transformation Predicate Pushdown Determining Join Ordering s bid=100 rating > 5 s R 1 R 2. R n Join tree: sid=sid Reserves sid=sid Sailors (Scan; write to temp T1) bid=100 Reserves (Scan; rating > 5 write to temp T2) Sailors The earlier we process selections, less tuples we need to manipulate higher up in the tree. Disadvantages? R 3 R 1 R 2 R 4 A join tree represents a plan. 1
2 Left Deep Trees Good for pipelining Hash-Join Partition both relations using hash fn h: R tuples in partition i will only match S tuples in partition i. Original Relation... OUTPUT INPUT 2 hash function h B-1 1 Partitions 1 2 B-1 Disk B main memory buffers Disk R 3 R 1 R 5 R 2 R 4 Read in a partition of R, hash it using h2 (<> h!). Scan matching partition of S, search for matches. Partitions of R & S Disk hash fn h2 Hash table for partition Ri (k < B-1 pages) h2 Input buffer for Si Output buffer B main memory buffers Join Result Disk Cost of Hash-Join In partitioning phase, read+write both relations; 2(M+N). In matching phase, read both relations; M+N I/Os. Sort-Merge Join Sort R and S on the join column, then scan them to do a ``merge on the join column. Advance scan of R until current R-tuple >= current S tuple, then advance scan of S until current S- tuple >= current R tuple; do this until current R tuple = current S tuple. At this point, all R tuples with same value and all S tuples with same value match; output <r, s> for all pairs of such tuples. Then resume scanning R and S. Cost of Sort-Merge Join But in Data Integration R is scanned once; each S is scanned once per matching R tuple. Cost: M log M + N log N + (M+N) The cost of scanning, M+N, could be M*N (unlikely!) Sort-Merge Join vs. Hash Join: Given a minimum amount of memory both have a cost of 3(M+N) I/Os. Hash Join superior on this count if relation sizes differ greatly. Also, Hash Join shown to be highly parallelizable. Few statistics, if any autonomous sources Unanticipated delays and failures network-bound sources A query plan can look good but not work well Desiderata: optimize time to first tuples Reduce load on sources 2
3 Adaptive Query Processing Double Pipelined Join Reconsider query plan during execution! But when? How? Operators better suited to dynamic environments Double pipelined join. Hash Join Partially pipelined: no output until inner read Asymmetric (inner vs. outer) optimization requires source behavior knowledge Double Pipelined Hash Join Outputs data immediately Symmetric requires less source knowledge to optimize Re-optimization (1) Re-optimization (2) Re-optimize at materialization points R 4 Insert conditionals into plan: R 4 R 2 R 2 R 5 R 5 R 3 R 1 R 3 R 1 if C then join with R 5 otherwise, R 2 Other Radical Options Eddies: a separate plan for every tuple Depends on speed and selectivity But decisions are very local Parallel execution: Try out 2(+) plans and see which goes better Terminate the other one. Multiple Challenges Don t increase the cost of planning Minimize wasted work Tradeoff local vs. global decisions Don t get stuck because of one bad decision Partition plan vs. data? 3
4 R 0 S 0 T 0 R 0 S 0 R 0 Adaptive Data Partitioning S 0 R S T R 1 S 1 T 1 T 0 S 1 T R 1 1 R 0 S 0 S 1 T 1 Exclude R 0 S 0 R 0 S 0 R 1 Exclude R 0 S 0 T 0, R 1 S 1 T 1 T 0 T 1 S 1 Query Processing Summary We don t have the usual statistics Hence, need to be adaptive Adaptivity needs to trade off several factors From a theoretical viewpoint, this is still an open problem. And what if results are assumed to be approximate? R S T XML and Data Integration XML The Data Integration Appetizer XML: whetted the integration appetites We have the syntax Now just solve the silly semantics problems Don t bother: we ll all standardize on DTDs. XML had a significant role on the data integration industry and research. XML <bibliography> <book> <title> Foundations </title> </book> </bibliography> <author> Abiteboul </author> <author> Hull </author> <author> Vianu </author> <publisher> Addison Wesley </publisher> <year> 1995 </year> XML describes the content vs. presentation XML Terminology tags: book, title, author, start tag: <book>, end tag: </book> elements: <book> <book>,<author> </author> elements are nested empty element: <red></red> abbrv. <red/> an XML document: single root element well formed XML document: if it has matching tags 4
5 More XML: Attributes <book price = 55 currency = USD > <title> Foundations of Databases </title> <author> Abiteboul </author> <year> 1995 </year> </book> attributes are alternative ways to represent data More XML: Oids and References <person id= o555 > <> Jane </> <person id= o456 > <> Mary </> <children idref= o123 o555 /> <person id= o123 mother= o456 ><>John</> oids and references in XML are just syntax XML Semantics: a Tree! <data> <person id= o555 > <> Mary </> <address> <street> Maple </street> <no> 345 </no> <city> Seattle </city> </address> <person> <> John </> <address> Thailand </address> <phone> </phone> </data> id o555 Attribute node Mary person address street no city data Maple 345 Seattle Order matters!!! John person address Thai Text node Element node phone XML Data XML is self-describing Schema elements become part of the data Relational schema: persons(,phone) In XML <persons>, <>, <phone> are part of the data, and are repeated many times Consequence: XML is much more flexible XML = semistructured data Relational Data as XML person XML: person n a m e p h o n e J o h n S u e D i c k row row row phone phone phone John 3634 Sue 6343 Dick 6363 <person> <row> <>John</> <phone> 3634</phone></row> <row> <>Sue</> <phone> 6343</phone> <row> <>Dick</> <phone> 6363</phone></row> XML is Semi-structured Data Missing attributes: Could represent in a table with nulls <person> <> John</> <phone>1234</phone> <person> <>Joe</> no phone! John Joe phone
6 XML is Semi-structured Data XML is Semi-structured Data Repeated attributes <person> <> Mary</> <phone>2345</phone> <phone>3456</phone> two phones! Attributes with different types in different objects <person> <> <first> John </first> <last> Smith </last> </> <phone>1234</phone> structured! Impossible in tables: Mary phone ??? Nested collections (no 1NF) Heterogeneous collections: <db> contains both <book>s and <publisher>s Document Type Definitions DTD part of the original XML specification an XML document may have a DTD XML document: well-formed = if tags are correctly closed Valid = if it has a DTD and conforms to it validation is useful in data exchange Very Simple DTD <!DOCTYPE company [ <!ELEMENT company ((person product)*)> <!ELEMENT person (ssn,, office, phone?)> <!ELEMENT ssn (#PCDATA)> <!ELEMENT (#PCDATA)> <!ELEMENT office (#PCDATA)> <!ELEMENT phone (#PCDATA)> <!ELEMENT product (pid,, description?)> <!ELEMENT pid (#PCDATA)> <!ELEMENT description (#PCDATA)> ]> Very Simple DTD Example of valid XML document: <company> <person> <ssn> </ssn> <> John </> <office> B432 </office> <phone> 1234 </phone> <person> <ssn> </ssn> <> Jim </> <office> B123 </office> <product>... </product>... </company> Querying XML Data XPath = simple navigation through the tree = the SQL of XML 6
7 Sample Data for Queries <bib> <book> <publisher> Addison-Wesley </publisher> <author> Serge Abiteboul </author> <author> <first-> Rick </first-> <last-> Hull </last-> </author> <author> Victor Vianu </author> <title> Foundations of Databases </title> <year> 1995 </year> </book> <book price= 55 > <publisher> Freeman </publisher> <author> Jeffrey D. Ullman </author> <title> Principles of Database and Knowledge Base Systems </title> <year> 1998 </year> </book> </bib> Data Model for XPath The root bib The root element book book publisher author.... Addison-Wesley Serge Abiteboul XPath: Simple Expressions /bib/book/year Result: <year> 1995 </year> <year> 1998 </year> /bib/paper/year XPath: Restricted Kleene Closure //author Result:<author> Serge Abiteboul </author> <author> <first-> Rick </first-> <last-> Hull </last-> </author> <author> Victor Vianu </author> <author> Jeffrey D. Ullman </author> Result: empty (there were no papers) /bib//first- Result: <first-> Rick </first-> Xpath: Text Nodes /bib/book/author/text() Result: Serge Abiteboul Jeffrey D. Ullman Rick Hull doesn t appear because he has first, last Functions in XPath: text() = matches the text value node() = matches any node (= * or text()) () = returns the of the current tag //author/* Xpath: Wildcard Result: <first-> Rick </first-> <last-> Hull </last-> * Matches any element 7
8 Result: 55 Xpath: Attribute means that price is has to be an attribute XPath: Predicates /bib/book/author[first] Result: <author> <first-> Rick </first-> <last-> Hull </last-> </author> XPath: More Predicates Xpath: More Predicates /bib/book/author[first][address[//zip][city]]/last < 60 ] Result: <last> </last> <last> </last> /bib/book[author/@age < 25 ] /bib/book[author/text()] Xpath: Summary bib matches a bib element * matches any element / matches the root element /bib bib/paper bib//paper //paper paper bib/book/@price matches a bib element under root matches a paper in bib matches a paper in bib, at any depth matches a paper at any depth matches a paper or a book matches a price attribute matches price attribute in book, in bib bib/book/[@price< 55 ]/author/last matches XML: Query Language History XPath was there Nobody thought to join XML data DB community (circa 95-96) Semi-structured data: Lorel, UnQL, StruQL XML-QL: applied StruQL to XML XML paper-mill starts working formed (1998) But not in place when some of us needed it. 8
9 Based on Quilt, which is based on XML- QL Uses XPath to express more complex queries FLWR ( Flower ) Expressions FOR... LET... WHERE... RETURN... Find all book titles published after 1995: FOR $x IN document("bib.xml")/bib/book WHERE $x/year > 1995 RETURN { $x/title } Find book titles by the coauthors of Database Theory : FOR $x IN bib/book[title/text() = Database Theory ]/author $y IN bib/book[author/text() = $x/text()]/title RETURN <answer> { $y/text() } </answer> Result: <title> abc </title> <title> def </title> <title> ghi </title> The answer will contain duplicates! Result: <answer> abc </ answer > < answer > def </ answer > < answer > ghi </ answer > Same as before, but eliminate duplicates: FOR $x IN bib/book[title/text() = Database Theory ]/author $y IN distinct(bib/book[author/text() = $x/text()]/title) RETURN <answer> { $y/text() } </answer> distinct = a function that eliminates duplicates Result: <answer> abc </ answer > < answer > def </ answer > < answer > ghi </ answer > : Nesting For each author of a book by Morgan Kaufmann, list all books she published: FOR $a IN distinct(document("bib.xml") /bib/book[publisher= Morgan Kaufmann ]/author) RETURN <result> { $a, FOR $t IN /bib/book[author=$a]/title RETURN $t } </result> 9
10 Result: <result> <author>jones</author> <title> abc </title> <title> def </title> </result> <result> <author> Smith </author> <title> ghi </title> </result> FOR $x in expr -- binds $x to each value in the list expr LET $x = expr -- binds $x to the entire list expr Useful for common subexpressions and for aggregations <big_publishers> FOR $p IN distinct(document("bib.xml")//publisher) LET $b := document("bib.xml")/book[publisher = $p] WHERE count($b) > 100 RETURN { $p } </big_publishers> Find books whose price is larger than average: LET $a=avg( /bib/book/price) FOR $b in /bib/book WHERE $b/price > $a RETURN { $b } count = a (aggregate) function that returns the number of elms Let s try to write this in SQL Summary: FOR-LET-WHERE-RETURN = FLWR FOR/LET Clauses WHERE Clause RETURN Clause List of tuples List of tuples XML & Data Integration Need to extend every aspect of the system to handle XML Great if you re looking for papers to write! Schema mapping languages AQUV, containment Query processing Storage Update language Instance of Xquery data model 10
11 An XML Mapping Language <students> { for $p in /projects/project, $pmember in $p/, $studname in $pmember//text(), $pos in $pmember/position/text() where $pos = student return <student> <> { $studname } </> {for $sp in /projects/project, $pname in $sp//text(), $mname in $sp///text() where $mname = $studname return <project> { $pname } </project> } </student> } </students> Target schema (UW): Source schema (UPenn) students student advisor projects project project position What is Query Containment? Input D Output Q(D) Instance containment Query containment Relational Query Sets of tuples A set of tuples Q(D) Q (D) -- Subset Q Q -- for every input D, Q(D) Q (D) What is Query Containment? Example An XML Instance Input D Output Q(D) Instance containment Query containment Relational Query Sets of tuples A set of tuples Q(D) Q (D) -- Subset Q Q -- for every input D, Q(D) Q (D) XML Query An XML instance tree An XML instance tree Q(D) Q (D) -- Tree homomorphism Q Q --for every input D, Q(D) Q (D) D: <project> <></> </project> <project> <></> </project> project project : leaf nodes Example An XML Query Example Another XML Query Q1: FOR $x IN /project RETURN <>{ FOR $y IN $x/ RETURN <>{ FOR $z IN $y[text()= ] RETURN </> FOR $z IN $y[text()= ] RETURN </> }</> }</> D: project Q1(D): project Q2: FOR $x IN /project RETURN <>{ FOR $y IN /project/ RETURN <>{ FOR $z IN $y[text()= ] RETURN </> FOR $z IN $y[text()= ] RETURN </> }</> }</> D: Q2(D): project project 11
12 Example -- Tree Homomorphism and XML Instance Containment Q1(D): Q1(D): Q2(D): Q1(D) Q2(D) Q2(D): Q2(D) X Q1(D) Complexity for XPaths Restriction With //, * With *, [] (branch) With //, [] With //, *, [] With //, [], Equi-join on tags With //, *, [], Equi-join on tags, disjunction Regular Expression Complexity PTIME PTIME PTIME CO-NPC NPC 2 P -complete PSPACE-hard Citation [Amer-Yahia et al., 2001] [Milo and Suciu, 1999] [Miklao and Suciu, 2002] [Deutsch and Tannen, 2001] [Florescu et al., 1998] Complexity for Nested XPaths Restriction With //, * With *, [] (branch) With //, [] With //, *, [] With //, [], Equi-join on tags With //, *, [], Equi-join on tags, disjunction Regular Expression XPATH-Complexity PTIME PTIME PTIME CO-NPC NPC 2 P -complete PSPACE-hard Nested-Query Complexity (with fixed depth) CO-NPC CO-NPC 2 P -complete 2 P -complete PSPACE-hard? (not sure) Q1: <result> faculty Containment Algorithm(1): Query Head Embedding db people position $pos= professor <people> Query Head student <student> <> {$student} advisee $advisee = $student <advisor> {$} Query head embedding: <result> <people> db <faculty> <> people faculty student <student> {$} {$student} faculty advisee $advisee = $student <advisor> {$} :Q2 <result> Containment Algorithm(2): Query Body Embedding db db faculty people people <people> Q1: position $pos= professor Query body embedding: :Q2 <people> <faculty> student <student> <> {$student} advisee $advisee = $student <advisor> {$} <result> student <student> <> {$student} faculty advisee $advisee = $student <advisor> {$} XML Summary Great for data integration: People could envision sharing data Great for research: XML most popular topic at conferences for a few years Great for industry: Many services built on XML Let s declare victory and move on.. 12
13 Model Management [Bernstein et al.] Generic infrastructure for managing schemas and mappings: Manipulate models and mappings as bulk objects Operators to create & compose mappings, merge & diff models Short operator scripts can solve schema integration, schema evolution, reverse engineering, etc. First challenge: semantics of operators. 13
Introduction to Data Management CSE 344
Introduction to Data Management CSE 344 Lecture 11: XML and XPath 1 XML Outline What is XML? Syntax Semistructured data DTDs XPath 2 What is XML? Stands for extensible Markup Language 1. Advanced, self-describing
More informationIntroduction to Database Systems CSE 444
Introduction to Database Systems CSE 444 Lecture 25: XML 1 XML Outline XML Syntax Semistructured data DTDs XPath Coverage of XML is much better in new edition Readings Sections 11.1 11.3 and 12.1 [Subset
More informationIntroduction to Database Systems CSE 414
Introduction to Database Systems CSE 414 Lecture 13: XML and XPath 1 Announcements Current assignments: Web quiz 4 due tonight, 11 pm Homework 4 due Wednesday night, 11 pm Midterm: next Monday, May 4,
More information10/24/12. What We Have Learned So Far. XML Outline. Where We are Going Next. XML vs Relational. What is XML? Introduction to Data Management CSE 344
What We Have Learned So Far Introduction to Data Management CSE 344 Lecture 12: XML and XPath A LOT about the relational model Hand s on experience using a relational DBMS From basic to pretty advanced
More informationIntroduction to XML. Yanlei Diao UMass Amherst April 17, Slides Courtesy of Ramakrishnan & Gehrke, Dan Suciu, Zack Ives and Gerome Miklau.
Introduction to XML Yanlei Diao UMass Amherst April 17, 2008 Slides Courtesy of Ramakrishnan & Gehrke, Dan Suciu, Zack Ives and Gerome Miklau. 1 Structure in Data Representation Relational data is highly
More informationIntroduction to Database Systems CSE 414
Introduction to Database Systems CSE 414 Lecture 14-15: XML CSE 414 - Spring 2013 1 Announcements Homework 4 solution will be posted tomorrow Midterm: Monday in class Open books, no notes beyond one hand-written
More informationAdditional Readings on XPath/XQuery Main source on XML, but hard to read:
Introduction to Database Systems CSE 444 Lecture 10 XML XML (4.6, 4.7) Syntax Semistructured data DTDs XML Outline April 21, 2008 1 2 Further Readings on XML Additional Readings on XPath/XQuery Main source
More informationIntroduction to Data Management CSE 344
Introduction to Data Management CSE 344 Lecture 16: Xpath, XQuery, JSON 1 Announcements Homework 4 due on Wednesday There was a small update on the last question Webquiz 6 due on Friday Midterm will be
More informationLecture 11: Xpath/XQuery. Wednesday, April 17, 2007
Lecture 11: Xpath/XQuery Wednesday, April 17, 2007 1 Outline XPath XQuery See recommend readings in previous lecture 2 Querying XML Data XPath = simple navigation through the tree XQuery = the SQL of XML
More informationQuerying XML Data. Querying XML has two components. Selecting data. Construct output, or transform data
Querying XML Data Querying XML has two components Selecting data pattern matching on structural & path properties typical selection conditions Construct output, or transform data construct new elements
More informationCSE 544 Data Models. Lecture #3. CSE544 - Spring,
CSE 544 Data Models Lecture #3 1 Announcements Project Form groups by Friday Start thinking about a topic (see new additions to the topic list) Next paper review: due on Monday Homework 1: due the following
More informationIntroduction to Semistructured Data and XML. Management of XML and Semistructured Data. Path Expressions
Introduction to Semistructured Data and XML Chapter 27, Part E Based on slides by Dan Suciu University of Washington Database Management Systems, R. Ramakrishnan 1 Management of XML and Semistructured
More informationXML Query Languages. Yanlei Diao UMass Amherst April 22, Slide content courtesy of Ramakrishnan & Gehrke, Donald Kossmann, and Gerome Miklau
XML Query Languages Yanlei Diao UMass Amherst April 22, 2008 Slide content courtesy of Ramakrishnan & Gehrke, Donald Kossmann, and Gerome Miklau 1 Querying XML How do you query a directed graph? a tree?
More informationXML and Semi-structured data
What is XML? Text annotation/markup language ( extensible Markup Language) XML and Semi-structured data Rich Feynman
More informationIntroduction to Semistructured Data and XML. Overview. How the Web is Today. Based on slides by Dan Suciu University of Washington
Introduction to Semistructured Data and XML Based on slides by Dan Suciu University of Washington CS330 Lecture April 8, 2003 1 Overview From HTML to XML DTDs Querying XML: XPath Transforming XML: XSLT
More informationIntroduction to Database Systems CSE 414
Introduction to Database Systems CSE 414 Lecture 14: XQuery, JSON 1 Announcements Midterm: Monday in class Review Sunday 2 pm, SAV 264 Includes everything up to, but not including, XML Closed book, no
More informationData Formats and APIs
Data Formats and APIs Mike Carey mjcarey@ics.uci.edu 0 Announcements Keep watching the course wiki page (especially its attachments): https://grape.ics.uci.edu/wiki/asterix/wiki/stats170ab-2018 Ditto for
More informationEXtensible Markup Language (XML) a W3C standard to complement HTML A markup language much like HTML
XML and XPath EXtensible Markup Language (XML) a W3C standard to complement HTML A markup language much like HTML origins: structured text SGML motivation: HTML describes presentation XML describes content
More informationIntroduction to Semistructured Data and XML
Introduction to Semistructured Data and XML Chapter 27, Part D Based on slides by Dan Suciu University of Washington Database Management Systems, R. Ramakrishnan 1 How the Web is Today HTML documents often
More informationIn this lecture. FLWR expressions FOR and LET expressions Collections and sorting
In this lecture Summary of XQuery Resources FLWR expressions FOR and LET expressions Collections and sorting XQuery: A Query Language for XML Chamberlin, Florescu, et al. W3C recommendation: www.w3.org/tr/xquery/
More informationXPath an XML query language
XPath an XML query language Some XML query languages: XML-QL XPath XQuery Many others 1 XML-QL http://www.w3.org/tr/note-xml-ql (8/98) Features: regular path expressions patterns, templates Skolem Functions
More informationXML and Web Services
XML and Web Services Lecture 8 1 XML (Section 17) Outline XML syntax, semistructured data Document Type Definitions (DTDs) XML Schema Introduction to XML based Web Services 2 Additional Readings on XML
More informationCSE 544 Principles of Database Management Systems. Lecture 4: Data Models a Never-Ending Story
CSE 544 Principles of Database Management Systems Lecture 4: Data Models a Never-Ending Story 1 Announcements Project Start to think about class projects If needed, sign up to meet with me on Monday (I
More informationCSE 544 Principles of Database Management Systems. Fall 2016 Lecture 4 Data models A Never-Ending Story
CSE 544 Principles of Database Management Systems Fall 2016 Lecture 4 Data models A Never-Ending Story 1 Announcements Project Start to think about class projects More info on website (suggested topics
More informationImplementation of Relational Operations
Implementation of Relational Operations Module 4, Lecture 1 Database Management Systems, R. Ramakrishnan 1 Relational Operations We will consider how to implement: Selection ( ) Selects a subset of rows
More informationXML Parsers XPath, XQuery
XML Parsers XPath, XQuery Lecture 10 1 XML parsers XPath XQuery XML publishing Outline Background (reading) http://www.w3.org/tr/xmlquery-use-cases/ several Xquery examples http://www.xmlportfolio.com/xquery.html
More informationEvaluation of Relational Operations: Other Techniques. Chapter 14 Sayyed Nezhadi
Evaluation of Relational Operations: Other Techniques Chapter 14 Sayyed Nezhadi Schema for Examples Sailors (sid: integer, sname: string, rating: integer, age: real) Reserves (sid: integer, bid: integer,
More informationEvaluation of Relational Operations. Relational Operations
Evaluation of Relational Operations Chapter 14, Part A (Joins) Database Management Systems 3ed, R. Ramakrishnan and J. Gehrke 1 Relational Operations v We will consider how to implement: Selection ( )
More informationEvaluation of Relational Operations
Evaluation of Relational Operations Chapter 14 Comp 521 Files and Databases Fall 2010 1 Relational Operations We will consider in more detail how to implement: Selection ( ) Selects a subset of rows from
More informationXML Background. The reason that so many people are excited about XML is that so many people are excited about XML. ANON
CS 186 Fall 2002 XML Databases The reason that so many people are excited
More informationEvaluation of Relational Operations
Evaluation of Relational Operations Yanlei Diao UMass Amherst March 13 and 15, 2006 Slides Courtesy of R. Ramakrishnan and J. Gehrke 1 Relational Operations We will consider how to implement: Selection
More informationAnnouncement. 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 informationEvaluation 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 informationChapter 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 informationLab Assignment 3 on XML
CIS612 Dr. Sunnie S. Chung Lab Assignment 3 on XML Semi-structure Data Processing: Transforming XML data to CSV format For Lab3, You can write in your choice of any languages in any platform. The Semi-Structured
More informationOverview 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 informationCSE 344 APRIL 16 TH SEMI-STRUCTURED DATA
CSE 344 APRIL 16 TH SEMI-STRUCTURED DATA ADMINISTRATIVE MINUTIAE HW3 due Wednesday OQ4 due Wednesday HW4 out Wednesday (Datalog) Exam May 9th 9:30-10:20 WHERE WE ARE So far we have studied the relational
More informationCompSci 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 informationFaloutsos 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 informationIntroduction to Data Management CSE 344
Introduction to Data Management CSE 344 Lecture 12: XQuery 1 XQuery Standard for high-level querying of databases containing data in XML form Based on Quilt, which is based on XML-QL Uses XPath to express
More informationExamples 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 informationCAS 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 informationChapter 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 informationXML Systems & Benchmarks
XML Systems & Benchmarks Christoph Staudt Peter Chiv Saarland University, Germany July 1st, 2003 Main Goals of our talk Part I Show up how databases and XML come together Make clear the problems that arise
More informationOverview 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 informationImplementation of Relational Operations. Introduction. CS 186, Fall 2002, Lecture 19 R&G - Chapter 12
Implementation of Relational Operations CS 186, Fall 2002, Lecture 19 R&G - Chapter 12 First comes thought; then organization of that thought, into ideas and plans; then transformation of those plans into
More informationDatabase Management
Database Management - 2011 Model Answers 1. a. A data model should comprise a structural part, an integrity part and a manipulative part. The relational model provides standard definitions for all three
More informationMidterm Review CS634. Slides based on Database Management Systems 3 rd ed, Ramakrishnan and Gehrke
Midterm Review CS634 Slides based on Database Management Systems 3 rd ed, Ramakrishnan and Gehrke Coverage Text, chapters 8 through 15 (hw1 hw4) PKs, FKs, E-R to Relational: Text, Sec. 3.2-3.5, to pg.
More informationChapter 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 informationJSON - Overview JSon Terminology
Announcements Introduction to Database Systems CSE 414 Lecture 12: Json and SQL++ Office hours changes this week Check schedule HW 4 due next Tuesday Start early WQ 4 due tomorrow 1 2 JSON - Overview JSon
More informationImplementing Joins 1
Implementing Joins 1 Last Time Selection Scan, binary search, indexes Projection Duplicate elimination: sorting, hashing Index-only scans Joins 2 Tuple Nested Loop Join foreach tuple r in R do foreach
More information5/2/16. Announcements. NoSQL Motivation. The New Hipster: NoSQL. Serverless. What is the Problem? Database Systems CSE 414
Announcements Database Systems CSE 414 Lecture 16: NoSQL and JSon Current assignments: Homework 4 due tonight Web Quiz 6 due next Wednesday [There is no Web Quiz 5 Today s lecture: JSon The book covers
More informationXML Overview COMP9319
XML Overview COMP9319 Raymond Wong XML XML (extensible Markup Language) is a standard developed by W3C (World Wide Web Consortium) and endorsed by a host of industry heavyweights such as IBM, Microsoft,
More informationDatabase Systems CSE 414
Database Systems CSE 414 Lecture 16: NoSQL and JSon CSE 414 - Spring 2016 1 Announcements Current assignments: Homework 4 due tonight Web Quiz 6 due next Wednesday [There is no Web Quiz 5] Today s lecture:
More informationPrinciples 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(One) Layer Model of the Semantic Web. Semantic Web - XML XML. Extensible Markup Language. Prof. Dr. Steffen Staab Dipl.-Inf. Med.
(One) Layer Model of the Semantic Web Semantic Web - XML Prof. Dr. Steffen Staab Dipl.-Inf. Med. Bernhard Tausch Steffen Staab - 1 Steffen Staab - 2 Slide 2 Extensible Markup Language Purpose here: storing
More informationRELATIONAL 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 informationXML in Databases. Albrecht Schmidt. al. Albrecht Schmidt, Aalborg University 1
XML in Databases Albrecht Schmidt al@cs.auc.dk http://www.cs.auc.dk/ al Albrecht Schmidt, Aalborg University 1 What is XML? (1) Where is the Life we have lost in living? Where is the wisdom we have lost
More informationCS330. 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 informationDatabase Applications (15-415)
Database Applications (15-415) DBMS Internals- Part VIII Lecture 16, March 19, 2014 Mohammad Hammoud Today Last Session: DBMS Internals- Part VII Algorithms for Relational Operations (Cont d) Today s Session:
More informationAdvanced 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 informationIntroduction 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 informationOverview 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 informationEvaluation of Relational Operations. SS Chung
Evaluation of Relational Operations SS Chung Cost Metric Query Processing Cost = Disk I/O Cost + CPU Computation Cost Disk I/O Cost = Disk Access Time + Data Transfer Time Disk Acess Time = Seek Time +
More informationCMSC424: 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 informationChapter 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 informationQuery Evaluation Overview, cont.
Query Evaluation Overview, cont. Lecture 9 Feb. 29, 2016 Slides based on Database Management Systems 3 rd ed, Ramakrishnan and Gehrke Architecture of a DBMS Query Compiler Execution Engine Index/File/Record
More informationEvaluation of Relational Operations
Evaluation of Relational Operations Chapter 12, Part A Database Management Systems, R. Ramakrishnan and J. Gehrke 1 Relational Operations We will consider how to implement: Selection ( ) Selects a subset
More informationQuery 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 informationAlgorithms 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 informationXML & DBs Interrogation des documents XML
XML & DBs Interrogation des documents XML A.Boukottaya Interrogation des documents XML HyOQL SGMLQL StruQL Before XML W3QL Lorel XMLQL.. XQL Xpath XML Xquery W3C standard 2 XPath (chemin = axes) Position
More informationQuery 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 informationCS 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 informationXQuery. Leonidas Fegaras University of Texas at Arlington. Web Databases and XML L7: XQuery 1
XQuery Leonidas Fegaras University of Texas at Arlington Web Databases and XML L7: XQuery 1 XQuery Influenced by SQL Based on XPath Purely functional language may access elements from documents, may construct
More informationQuery Evaluation Overview, cont.
Query Evaluation Overview, cont. Lecture 9 Slides based on Database Management Systems 3 rd ed, Ramakrishnan and Gehrke Architecture of a DBMS Query Compiler Execution Engine Index/File/Record Manager
More information! 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 informationChapter 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 informationA Quilt, not a Camel. Don Chamberlin Jonathan Robie Daniela Florescu. May 19, 2000
A Quilt, not a Camel Don Chamberlin Jonathan Robie Daniela Florescu May 19, 2000 The Web Changes Everything All kinds of information can be made available everywhere, all the time XML is the leading candidate
More informationCompSci 516 Data Intensive Computing Systems. Lecture 11. Query Optimization. Instructor: Sudeepa Roy
CompSci 516 Data Intensive Computing Systems Lecture 11 Query Optimization Instructor: Sudeepa Roy Duke CS, Fall 2017 CompSci 516: Database Systems 1 Announcements HW2 has been posted on sakai Due on Oct
More information15-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 informationOverview 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 informationDatabase 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 informationR & 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 informationQuery 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 informationL22: The Relational Model (continued) CS3200 Database design (sp18 s2) 4/5/2018
L22: The Relational Model (continued) CS3200 Database design (sp18 s2) https://course.ccs.neu.edu/cs3200sp18s2/ 4/5/2018 256 Announcements! Please pick up your exam if you have not yet HW6 will include
More informationQuerying XML. COSC 304 Introduction to Database Systems. XML Querying. Example DTD. Example XML Document. Path Descriptions in XPath
COSC 304 Introduction to Database Systems XML Querying Dr. Ramon Lawrence University of British Columbia Okanagan ramon.lawrence@ubc.ca Querying XML We will look at two standard query languages: XPath
More informationRELATIONAL ALGEBRA. CS 564- Fall ACKs: Dan Suciu, Jignesh Patel, AnHai Doan
RELATIONAL ALGEBRA CS 564- Fall 2016 ACKs: Dan Suciu, Jignesh Patel, AnHai Doan RELATIONAL QUERY LANGUAGES allow the manipulation and retrieval of data from a database two types of query languages: Declarative:
More informationXML Query Languages. Content. Slide 1 Norbert Gövert. January 11, XML documents as trees. Slide 2. Overview on XML query languages XQL
XML Query Languages Slide 1 Norbert Gövert January 11, 2001 Content Slide 2 XML documents as trees Overview on XML query languages XQL XIRQL: IR extension for XQL 1 XML documents as trees Slide 3
More informationEvaluation of Relational Operations: Other Techniques
Evaluation of Relational Operations: Other Techniques [R&G] Chapter 14, Part B CS4320 1 Using an Index for Selections Cost depends on #qualifying tuples, and clustering. Cost of finding qualifying data
More informationQuery Processing and Query Optimization. Prof Monika Shah
Query Processing and Query Optimization Query Processing SQL Query Is in Library Cache? System catalog (Dict / Dict cache) Scan and verify relations Parse into parse tree (relational Calculus) View definitions
More informationAnnouncements. JSon Data Structures. JSon Syntax. JSon Semantics: a Tree! JSon Primitive Datatypes. Introduction to Database Systems CSE 414
Introduction to Database Systems CSE 414 Lecture 13: Json and SQL++ Announcements HW5 + WQ5 will be out tomorrow Both due in 1 week Midterm in class on Friday, 5/4 Covers everything (HW, WQ, lectures,
More informationCopyright 2007 Ramez Elmasri and Shamkant B. Navathe. Slide 27-1
Slide 27-1 Chapter 27 XML: Extensible Markup Language Chapter Outline Introduction Structured, Semi structured, and Unstructured Data. XML Hierarchical (Tree) Data Model. XML Documents, DTD, and XML Schema.
More informationIntroduction to Semistructured Data and XML. Contents
Contents Overview... 106 What is XML?... 106 How the Web is Today... 108 New Universal Data Exchange Format: XML... 108 What is the W3C?... 108 Semistructured Data... 110 What is Self-describing Data?...
More informationDatabase Systems External Sorting and Query Optimization. A.R. Hurson 323 CS Building
External Sorting and Query Optimization A.R. Hurson 323 CS Building External sorting When data to be sorted cannot fit into available main memory, external sorting algorithm must be applied. Naturally,
More informationLecture 16. The Relational Model
Lecture 16 The Relational Model Lecture 16 Today s Lecture 1. The Relational Model & Relational Algebra 2. Relational Algebra Pt. II [Optional: may skip] 2 Lecture 16 > Section 1 1. The Relational Model
More informationEMERGING TECHNOLOGIES
EMERGING TECHNOLOGIES XML (Part 3): XQuery Outline 1. Introduction 2. Structure of XML data 3. XML Document Schema 3.1. Document Type Definition (DTD) 3.2. XMLSchema 4. Data Model for XML documents. 5.
More informationRelational 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 informationCost-based Query Sub-System. Carnegie Mellon Univ. Dept. of Computer Science /615 - DB Applications. Last Class.
Cost-based Query Sub-System Carnegie Mellon Univ. Dept. of Computer Science 15-415/615 - DB Applications Queries Select * From Blah B Where B.blah = blah Query Parser Query Optimizer C. Faloutsos A. Pavlo
More information4/10/2018. Relational Algebra (RA) 1. Selection (σ) 2. Projection (Π) Note that RA Operators are Compositional! 3.
Lecture 33: The Relational Model 2 Professor Xiannong Meng Spring 2018 Lecture and activity contents are based on what Prof Chris Ré of Stanford used in his CS 145 in the fall 2016 term with permission
More informationOverview. Structured Data. The Structure of Data. Semi-Structured Data Introduction to XML Querying XML Documents. CMPUT 391: XML and Querying XML
Database Management Systems Winter 2004 CMPUT 391: XML and Querying XML Lecture 12 Overview Semi-Structured Data Introduction to XML Querying XML Documents Dr. Osmar R. Zaïane University of Alberta Chapter
More information