# OVERVIEW OF QUERY EVALUATION

Save this PDF as:

Size: px
Start display at page:

## Transcription

1 12 OVERVIEW OF QUERY EVALUATION Exercise 12.1 Briefly answer the following questions: 1. Describe three techniques commonly used when developing algorithms for relational operators. Explain how these techniques can be used to design algorithms for the selection, projection, and join operators. 2. What is an access path? When does an index match an access path? What is a primary conjunct, andwhyisitimportant? 3. What information is stored in the system catalogs? 4. What are the benefits of storing the system catalogs as relations? 5. What is the goal of query optimization? Why is optimization important? 6. Describe pipelining and its advantages. 7. Give an example query and plan in which pipelining cannot be used. 8. Describe the iterator interface and explain its advantages. 9. What role do statistics gathered from the database play in query optimization? 10. What were the important design decisions made in the System R optimizer? 11. Why do query optimizers consider only left-deep join trees? Give an example of a query and a plan that would not be considered because of this restriction. Answer 12.1 The answer to each question is given below. 1. The three techniques commonly used are indexing, iteration, and partitioning: Indexing: If a selection or join condition is specified, use an index to examine just the tuples that satisfy the condition. 166

2 Overview of Query Evaluation 167 Iteration: Examine all tuples in an input table, one after the other. If we need only a few fields from each tuple and there is an index whose key contains all these fields, instead of examining data tuples, we can scan all index data entries. Partitioning: By partitioing tuples on a sort key, we can often decompose an operation into a less expensive collection of operations on partitions. Sorting and hashing are two commonly used partitioning techniques. They can be used to design algorithms for selection, projection, and join operators as follows: Selection: For a selection with more than one tuple matching the query (in general, at least 5%), indexing like B+ Trees are very useful. This comes into play often with range queries. It allows us to not only find the first qualifying tuple quickly, but also the other qualifying tuples soon after (especially if the index is clustered). For a selection condition with an equality query where there are only a few (usually 1) matching tuple, partitioning using hash indexing is often appropriate. It allows us to find the exact tuple we are searching for with a cost of only a few (typically one or two) I/Os. Projection: The projection operation requires us to drop certain fields of the input, which can result in duplicates appearing in the result set. If we do not need to remove these duplicates, then the iteration technique can efficiently handle this problem. On ther other hand, if we do need to eliminate duplicates, partitioning the data and applying a sort key is typically performed. In the case that there are appropriate indexes available, this can lead to less expensive plans for sorting the tuples during duplicate elimination since the data may all ready be sorted on the index (in that case we simply compare adjacent entries to check for duplicates) Join: The most expensive database operation, joins, can combinations of all three techniques. A join operation typically has multiple selection and projection elements built into it, so the importance of having appropriate indexes or of partitioning the data is just as above, if not more so. When possible, the individual selections and projections are applied to two relations before they are joined, so as to decrease the size of the intermediate table. As an example consider joining two relations with 100,000 tuples each and only 5 % of qualifying tuples in each table. Joining before applying the selection conditions, would result in a huge intermediate table size that would then have to be searched for matching selections. Alternatively, consider applying parts of the selection first. We can then perform a join of the 5,000 qualifying tuples found after applying the selection to each table, that can then be searched and handled significantly faster.

3 168 Chapter An access path is a way of retrieving tuples from a table and consists of either a file scan or an index plus a matching selection condition. An index matches a selection condition if the index can be used to retrieve just the tuples that satisfy the condition. An index can match some subset of conjunts in a selection condition even though it does not match the entire condition and we refer to the conjuct that the index matches as the primary conjuncts in the selection. Primary conjuncts are important because they allow us to quickly discard information we do not need and only focus in on searching/sorting the data that more closely matches the selection conditions. 3. Information about relations, indexes, and views is stored in the system catalogs. This includes file names, file sizes, and file structure, the attribute names and data types, lists of keys, and constraints. Some commonly stored statistical information includes: (a) Cardinality - the number of tuples for each relation (b) Size - the number of pages in each relation (c) Index Cardinality - the number of distinct key values for each index (d) Index Size - the number of pages for each index (or number of leaf pages) (e) Index Height - the number of nonleaf levels for each tree index (f) Index Range - the minimum present key value and the maximum present key value for each index. 4. There are several advantages to storing the system catatlogs as relations. Relational system catalogs take advantage of all of the implementation and management benefits of relational tables: effective information storage and rich querying capabilities. The choice of what system catalogs to maintain is left to the DBMS implementor. 5. The goal of query optimization is to avoid the worst plans and find a good plan. The goal is usually not to find the optimal plan. The difference in cost between a good plan and a bad plan can be several orders of magnitude: a good query plan can evaluate the query in seconds, whereas a bad query plan might take days! 6. Pipelining allows us to avoid creating and reading temporary relations; the I/O savings can be substantial. 7. Bushy query plans often cannot take advantage of pipelining because of limited buffer or CPU resources. Consider a bushy plan in which we are doing a selection on two relations, followed by a join. We cannot always use pipelining in this strategy becuase the result of the selection on the first selection may not fit in memory, and we must wait for the second relation s selection to complete before we can begin the join.

4 Overview of Query Evaluation The iterator interface for an operator includes the functions open, get next, and close; it hides the details of how the operator is implemented, and allows us to view all operator nodes in a query plan uniformly. 9. The query optimizer uses statistics to improve the chances of selecting an optimum query plan. The statistics are used to calculate reduction factors which determine the results the optimizer may expect given different indexes and inputs. 10. Some important design decisions in the System R optimizer are: (a) Using statistics about a database instance to estimate the cost of a query evaluation plan. (b) A decision to consider only plans with binary joins in which the inner plan is a base relation. This heuristic reduces the often significant number of alternative plans that must be considered. (c) A decision to focus optimization on the class of SQL queries without nesting and to treat nested queries in a relatively ad hoc way. (d) A decision not to perform duplicate elimination for projections (except as a final step in the query evaluation when required by a DISTINCT clause). (e) A model of cost that accounted for CPU costs as wellas I/O costs. 11. There are two main reasons for the decision to concentrate on left-deep plains only: (a) As the number of joins increases, the number of alternative plans increases rapidly and it becomes neccessary to prune the space of the alternative plans. (b) Left-deep trees allow us to generate all fully piplined plans; that is, plans in which all joins are evaluated using pipelining. Consider the join A B C D. The query plan (A B) (C D) would never be considered because it is a bushy tree. Exercise 12.2 Consider a relation R(a,b,c,d,e) containing 5,000,000 records, where each data page of the relation holds 10 records. R is organized as a sorted file with secondary indexes. Assume that R.a is a candidate key for R, with values lying in the range 0 to 4,999,999, and that R is stored in R.a order. For each of the following relational algebra queries, state which of the following three approaches is most likely to be the cheapest: Access the sorted file for R directly. Use a (clustered) B+ tree index on attribute R.a. Use a linear hashed index on attribute R.a.

5 170 Chapter σ a<50,000 (R) 2. σ a=50,000 (R) 3. σ a>50,000 a<50,010 (R) 4. σ a 50,000 (R) Answer 12.2 The answer to each question is given below. 1. σ a<50,000 (R) - For this selection, the choice of accessing the sorted file is slightly superior in cost to using the clused B+ tree index simply because of the lookup cost required on the B+ tree. 2. σ a=50,000 (R) - A linear hashed index should be cheapest here. 3. σ a>50,000 a<50,010 (R) - A B+ tree should be the cheapest of the three. 4. σ a 50,000 (R) - Since the selection will require a scan of the available entries, and we re starting at the beginning of the sorted index, accessing the sorted file should be slightly more cost-effective, again because of the lookup time. Exercise 12.3 For each of the following SQL queries, for each relation involved, list the attributes that must be examined to compute the answer. All queries refer to the following relations: Emp(eid: integer, did: integer, sal: integer, hobby: char(20)) Dept(did: integer, dname: char(20), floor: integer, budget: real) 1. SELECT * FROM Emp E 2. SELECT * FROM Emp E, Dept D 3. SELECT * FROM Emp E, Dept D WHERE E.did = D.did 4. SELECT E.eid, D.dname FROM Emp E, Dept D WHERE E.did = D.did Answer 12.3 The answer to each question is given below. 1. E.eid, E.did, E.sal, E.hobby 2. E.eid, E.did, E.sal, E.hobby, D.did, D.dname, D.floor, D.budget 3. E.eid, E.did, E.sal, E.hobby, D.did, D.dname, D.floor, D.budget 4. E.eid, D.dname, E.did, D.did

6 Overview of Query Evaluation 171 Exercise 12.4 Consider the following schema with the Sailors relation: Sailors(sid: integer, sname: string, rating: integer, age: real) For each of the following indexes, list whether the index matches the given selection conditions. If there is a match, list the primary conjuncts. 1. A B+-tree index on the search key Sailors.sid. 2. A hash index on the search key Sailors.sid. 3. A B+-tree index on the search key Sailors.sid, Sailors.age. (a) σ Sailors.sid<50,000 Sailors.age=21 (Sailors) (b) σ Sailors.sid=50,000 Sailors.age>21 (Sailors) (c) σ Sailors.sid=50,000 (Sailors) (d) σ Sailors.age=21 (Sailors) 4. A hash-tree index on the search key Sailors.sid, Sailors.age. (a) σ Sailors.sid=50,000 Sailors.age=21 (Sailors) (b) σ Sailors.sid=50,000 Sailors.age>21 (Sailors) (c) σ Sailors.sid=50,000 (Sailors) (d) σ Sailors.age=21 (Sailors) Answer 12.4 The answer to each question is given below. 1. (a) Match. Primary conjuncts are: Sailors.sid < 50,000 (b) Match. Primary conjuncts are: Sailors.sid = 50, (a) No Match. Range queries cannot be applied to hash indexes. (b) Match. Primary conjunct are: Sailors.sid = 50, (a) Match. Primary conjunct are: Sailors.sid < 50,000 and Sailors.sid < 50,000 Saliors.age = 21

7 172 Chapter 12 (b) Match. Primary conjunct are: Sailors.sid = 50,000 and Sailors.sid = 50,000 Saliors.age > 21 (c) Match. Primary conjunct are: Sailors.sid = 50,000 (d) No Match. The index on Sailors.sid, Sailors.age is primarily sorted on Sailors.sid, therefore the entire relation would need to be searched to find those with a particular Sailors.age value. 4. (a) Match. Primary conjunct are: Sailors.sid = 50,000 and Sailors.sid = 50,000 Saliors.age = 21 (b) Match. Primary conjunct are: Sailors.sid = 50,000 (c) Match. Primary conjunct are: Sailors.sid = 50,000 (d) No Match. The index on Sailors.sid, Sailors.age does not allow us to retrieve sets of sailors with age equal to 21. Exercise 12.5 Consider again the schema with the Sailors relation: Sailors(sid: integer, sname: string, rating: integer, age: real) Assume that each tuple of Sailors is 50 bytes long, that a page can hold 80 Sailors tuples, and that we have 500 pages of such tuples. For each of the following selection conditions, estimate the number of pages retrieved, given the catalog information in the question. 1. Assume that we have a B+-tree index T on the search key Sailors.sid, andassume that IHeight(T )=4,INPages(T ) = 50, Low(T ) = 1, and High(T ) = 100, Assume that we have a hash index T on the search key Sailors.sid, and assume that IHeight(T )=2,INPages(T ) = 50, Low(T ) = 1, and High(T ) = 100,000. Answer 12.5 The answer to each question is given below. 1. (a) Assuming uniform distribution, around half of the 40,000 tuples will match the selection condition. The total cost is then the cost of finding the first leaf node (4 I/O s) plus the cost of retrieving the matching tuples. If the index is clustered, then the total cost is I/O s = 254 I/O s. If the index is

### University of Massachusetts Amherst Department of Computer Science Prof. Yanlei Diao

University of Massachusetts Amherst Department of Computer Science Prof. Yanlei Diao CMPSCI 445 Midterm Practice Questions NAME: LOGIN: Write all of your answers directly on this paper. Be sure to clearly

### ICS 434 Advanced Database Systems

ICS 434 Advanced Database Systems Dr. Abdallah Al-Sukairi sukairi@kfupm.edu.sa Second Semester 2003-2004 (032) King Fahd University of Petroleum & Minerals Information & Computer Science Department Outline

### 8. Query Processing. Query Processing & Optimization

ECS-165A WQ 11 136 8. Query Processing Goals: Understand the basic concepts underlying the steps in query processing and optimization and estimating query processing cost; apply query optimization techniques;

### OVERVIEW OF STORAGE AND INDEXING

8 OVERVIEW OF STORAGE AND INDEXING Exercise 8.1 Answer the following questions about data on external storage in a DBMS: 1. Why does a DBMS store data on external storage? 2. Why are I/O costs important

### Query Processing, optimization, and indexing techniques

Query Processing, optimization, and indexing techniques What s s this tutorial about? From here: SELECT C.name AS Course, count(s.students) AS Cnt FROM courses C, subscription S WHERE C.lecturer = Calders

### Kathleen Durant PhD Lecture 19 CS 3200 Northeastern University. Slide Content Courtesy of R. Ramakrishnan, J. Gehrke, and J.

Relational Query Optimization Kathleen Durant PhD Lecture 19 CS 3200 Northeastern University 1 Slide Content Courtesy of R. Ramakrishnan, J. Gehrke, and J. Hellerstein Overview of Query Evaluation Query

### Chapter 13: Query Processing. Basic Steps in 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

### CSE 444 Practice Problems. Query Optimization

CSE 444 Practice Problems Query Optimization 1. Query Optimization Given the following SQL query: Student (sid, name, age, address) Book(bid, title, author) Checkout(sid, bid, date) SELECT S.name FROM

### ! Overview! Measures of Query Cost! Selection Operation! Sorting! Join Operation! Other Operations! Evaluation of Expressions

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

### Query Processing + Optimization: Outline

Query Processing + Optimization: Outline Operator Evaluation Strategies Query processing in general Selection Join Query Optimization Heuristic query optimization Cost-based query optimization Query Tuning

### Overview of Storage and Indexing. Data on External Storage. Alternative File Organizations. Chapter 8

Overview of Storage and Indexing Chapter 8 How index-learning turns no student pale Yet holds the eel of science by the tail. -- Alexander Pope (1688-1744) Database Management Systems 3ed, R. Ramakrishnan

### Overview of Storage and Indexing

Overview of Storage and Indexing Chapter 8 How index-learning turns no student pale Yet holds the eel of science by the tail. -- Alexander Pope (1688-1744) Database Management Systems 3ed, R. Ramakrishnan

### SQL Query Evaluation. Winter 2006-2007 Lecture 23

SQL Query Evaluation Winter 2006-2007 Lecture 23 SQL Query Processing Databases go through three steps: Parse SQL into an execution plan Optimize the execution plan Evaluate the optimized plan Execution

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

### Comp 5311 Database Management Systems. 16. Review 2 (Physical Level)

Comp 5311 Database Management Systems 16. Review 2 (Physical Level) 1 Main Topics Indexing Join Algorithms Query Processing and Optimization Transactions and Concurrency Control 2 Indexing Used for faster

### Plan for the Query Optimization topic

VICTORIA UNIVERSITY OF WELLINGTON Te Whare Wananga o te Upoko o te Ika a Maui COMP302 Database Systems Plan for the Query Optimization topic COMP302 Database Systems Query Optimisation_04 1 What is Query

### 7. Indexing. Contents: Single-Level Ordered Indexes Multi-Level Indexes B + Tree based Indexes Index Definition in SQL.

ECS-165A WQ 11 123 Contents: Single-Level Ordered Indexes Multi-Level Indexes B + Tree based Indexes Index Definition in SQL 7. Indexing Basic Concepts Indexing mechanisms are used to optimize certain

### Record Storage, File Organization, and Indexes

Record Storage, File Organization, and Indexes ISM6217 - Advanced Database Updated October 2005 1 Physical Database Design Phase! Inputs into the Physical Design Phase " Logical (implementation) model

### Lecture 6: Query optimization, query tuning. Rasmus Pagh

Lecture 6: Query optimization, query tuning Rasmus Pagh 1 Today s lecture Only one session (10-13) Query optimization: Overview of query evaluation Estimating sizes of intermediate results A typical query

### Answer Key. UNIVERSITY OF CALIFORNIA College of Engineering Department of EECS, Computer Science Division

Answer Key UNIVERSITY OF CALIFORNIA College of Engineering Department of EECS, Computer Science Division CS186 Fall 2003 Eben Haber Midterm Midterm Exam: Introduction to Database Systems This exam has

### DATABASE DESIGN - 1DL400

DATABASE DESIGN - 1DL400 Spring 2015 A course on modern database systems!! http://www.it.uu.se/research/group/udbl/kurser/dbii_vt15/ Kjell Orsborn! Uppsala Database Laboratory! Department of Information

### In order to minimize the execution cost is possible: . minimize the size of intermediates results.

Query Optimization The query optimizer is the most important block in DBMS: it generates the strategy called execution plan. This module also defines how reads are performed:. directly;. with indices.

### Q4. What are data model? Explain the different data model with examples. Q8. Differentiate physical and logical data independence data models.

FAQs Introduction to Database Systems and Design Module 1: Introduction Data, Database, DBMS, DBA Q2. What is a catalogue? Explain the use of it in DBMS. Q3. Differentiate File System approach and Database

### Assignment 3: SQL Queries. Questions 1. The following relations keep track of airline flight information:

Database Systems Instructors: Hao-Hua Chu Winston Hsu Fall Semester, 2007 Assignment 3: SQL Queries Questions 1. The following relations keep track of airline flight information: Flightsflno: integer,

### Query Optimization. Coming to Introduction to Database Systems by C. J. Date, he discussed the automatic optimization.

Query Optimization Introduction: Query optimization is a function of many relational database management systems in which multiple query plans for satisfying a query are examined and a good query plan

### There are five fields or columns, with names and types as shown above.

3 THE RELATIONAL MODEL Exercise 3.1 Define the following terms: relation schema, relational database schema, domain, attribute, attribute domain, relation instance, relation cardinality, andrelation degree.

### SQL: QUERIES, CONSTRAINTS, TRIGGERS

5 SQL: QUERIES, CONSTRAINTS, TRIGGERS Online material is available for all exercises in this chapter on the book s webpage at http://www.cs.wisc.edu/~dbbook This includes scripts to create tables for each

### D B M G Data Base and Data Mining Group of Politecnico di Torino

Database Management Data Base and Data Mining Group of tania.cerquitelli@polito.it A.A. 2014-2015 Optimizer objective A SQL statement can be executed in many different ways The query optimizer determines

### Query Processing C H A P T E R12. Practice Exercises

C H A P T E R12 Query Processing Practice Exercises 12.1 Assume (for simplicity in this exercise) that only one tuple fits in a block and memory holds at most 3 blocks. Show the runs created on each pass

### Query processing. Tore Risch Information Technology Uppsala University

Query processing Tore Risch Information Technology Uppsala University 2011-03-08 What is query processing? A given SQL query is translated by the query processor into a low level program called an execution

### Database System Architecture and Implementation

Database System Architecture and Implementation Kristin Tufte Execution Costs 1 Web Forms Orientation Applications SQL Interface SQL Commands Executor Operator Evaluator Parser Optimizer DBMS Transaction

Chapter 7. Indexes Table of Contents Objectives... 1 Introduction... 2 Context... 2 Review Questions... 3 Single-level Ordered Indexes... 4 Primary Indexes... 4 Clustering Indexes... 8 Secondary Indexes...

### Access Path Selection in a Relational Database Management System

Access Path Selection in a Relational Database Management System P. Griffiths Selinger M. M. Astrahan D. D. Chamberlin R. A. Lorie T. G. Price IBM Research Division, San Jose, California 95193 ABSTRACT:

### CIS 631 Database Management Systems Sample Final Exam

CIS 631 Database Management Systems Sample Final Exam 1. (25 points) Match the items from the left column with those in the right and place the letters in the empty slots. k 1. Single-level index files

### 1Z0-117 Oracle Database 11g Release 2: SQL Tuning. Oracle

1Z0-117 Oracle Database 11g Release 2: SQL Tuning Oracle To purchase Full version of Practice exam click below; http://www.certshome.com/1z0-117-practice-test.html FOR Oracle 1Z0-117 Exam Candidates We

### Query Optimization for Distributed Database Systems Robert Taylor Candidate Number : 933597 Hertford College Supervisor: Dr.

Query Optimization for Distributed Database Systems Robert Taylor Candidate Number : 933597 Hertford College Supervisor: Dr. Dan Olteanu Submitted as part of Master of Computer Science Computing Laboratory

### Elena Baralis, Silvia Chiusano Politecnico di Torino. Pag. 1. Physical Design. Phases of database design. Physical design: Inputs.

Phases of database design Application requirements Conceptual design Database Management Systems Conceptual schema Logical design ER or UML Physical Design Relational tables Logical schema Physical design

### Storage and Indexing. DBS Database Systems Implementing and Optimising Query Languages. Differences between disk and main memory

DBS Database Systems Implementing and Optimising Query Languages Peter Buneman 9 November 2010 Reading: R&G Chapters 8, 9 & 10.1 Storage and Indexing We typically store data in external (secondary) storage.

### Evaluation of Expressions

Query Optimization Evaluation of Expressions Materialization: one operation at a time, materialize intermediate results for subsequent use Good for all situations Sum of costs of individual operations

### Chapter 14 Query Optimization

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

### Chapter 6: Physical Database Design and Performance. Database Development Process. Physical Design Process. Physical Database Design

Chapter 6: Physical Database Design and Performance Modern Database Management 6 th Edition Jeffrey A. Hoffer, Mary B. Prescott, Fred R. McFadden Robert C. Nickerson ISYS 464 Spring 2003 Topic 23 Database

### Inside the PostgreSQL Query Optimizer

Inside the PostgreSQL Query Optimizer Neil Conway neilc@samurai.com Fujitsu Australia Software Technology PostgreSQL Query Optimizer Internals p. 1 Outline Introduction to query optimization Outline of

### Database 2 Lecture II. Alessandro Artale

Free University of Bolzano Database 2. Lecture II, 2003/2004 A.Artale (1) Database 2 Lecture II Alessandro Artale Faculty of Computer Science Free University of Bolzano Room: 221 artale@inf.unibz.it http://www.inf.unibz.it/

### Performance Tuning for the Teradata Database

Performance Tuning for the Teradata Database Matthew W Froemsdorf Teradata Partner Engineering and Technical Consulting - i - Document Changes Rev. Date Section Comment 1.0 2010-10-26 All Initial document

### Chapter 7: Optimization of Distributed Queries

Chapter 7: Optimization of Distributed Queries Basic Concepts Distributed Cost Model Database Statistics Joins and Semijoins Query Optimization Algorithms Acknowledgements: I am indebted to Arturas Mazeika

### arm DBMS File Organization, Indexes 1. Basics of Hard Disks

DBMS File Organization, Indexes 1. Basics of Hard Disks All data in a DB is stored on hard disks (HD). In fact, all files and the way they are organised (e.g. the familiar tree of folders and sub-folders

### 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 Transformation of Relational Expressions Catalog

### Oracle EXAM - 1Z0-117. Oracle Database 11g Release 2: SQL Tuning. Buy Full Product. http://www.examskey.com/1z0-117.html

Oracle EXAM - 1Z0-117 Oracle Database 11g Release 2: SQL Tuning Buy Full Product http://www.examskey.com/1z0-117.html Examskey Oracle 1Z0-117 exam demo product is here for you to test the quality of the

### Homework 3: Normalization, Indexing SOLUTION. AB C ; D B ; AC D. Answer each question below and carefully justify your answer.

CS 461, Database Systems, Spring 2015 Problem 1 (25pts): Normalization Homework 3: Normalization, Indexing SOLUTION Consider relation R (ABCD) together with the following set of FDs: AB C ; D B ; AC D.

### Data Warehousing und Data Mining

Data Warehousing und Data Mining Multidimensionale Indexstrukturen Ulf Leser Wissensmanagement in der Bioinformatik Content of this Lecture Multidimensional Indexing Grid-Files Kd-trees Ulf Leser: Data

### Relational Algebra. CSE 544: Relational Operators, Sorting. What about Intersection? 1. Union and 2. Difference. 4. Projection. 3.

Relational Algebra CSE 544: Relational Operators, Sorting Wednesday, 5/12/2004 Operates on relations, i.e. sets Later: we discuss how to extend this to bags Five operators: Union: Difference: - Selection:

### Physical DB design and tuning: outline

Physical DB design and tuning: outline Designing the Physical Database Schema Tables, indexes, logical schema Database Tuning Index Tuning Query Tuning Transaction Tuning Logical Schema Tuning DBMS Tuning

### High-performance XML Storage/Retrieval System

UDC 00.5:68.3 High-performance XML Storage/Retrieval System VYasuo Yamane VNobuyuki Igata VIsao Namba (Manuscript received August 8, 000) This paper describes a system that integrates full-text searching

### SQL QUERY EVALUATION. CS121: Introduction to Relational Database Systems Fall 2015 Lecture 12

SQL QUERY EVALUATION CS121: Introduction to Relational Database Systems Fall 2015 Lecture 12 Query Evaluation 2 Last time: Began looking at database implementation details How data is stored and accessed

### Distributed Databases Query Optimisation. TEMPUS June, 2001

Distributed Databases Query Optimisation TEMPUS June, 2001 1 Topics Query processing in distributed databases Localization Distributed query operators Cost-based optimization 2 Decomposition Query Processing

### Query Optimization Example. Steps Query op5miza5on steps: 12/13/09

Query Optimization Example (sid, sname, ra5ng, age) (bid, bname, color) (sid, bid, day, rname) Query: SELECT S.sid, S.sname, S.age FROM S, B, R WHERE B.bid = R.rid AND B.bid = R.bid AND B.color = Red AND

### Elena Baralis, Silvia Chiusano Politecnico di Torino. Pag. 1. Query optimization. DBMS Architecture. Query optimizer. Query optimizer.

DBMS Architecture INSTRUCTION OPTIMIZER Database Management Systems MANAGEMENT OF ACCESS METHODS BUFFER MANAGER CONCURRENCY CONTROL RELIABILITY MANAGEMENT Index Files Data Files System Catalog BASE It

### Physical Database Design and Tuning

Chapter 20 Physical Database Design and Tuning Copyright 2011 Pearson Education, Inc. Publishing as Pearson Addison-Wesley 1. Physical Database Design in Relational Databases (1) Factors that Influence

Chapter 20 Physical Database Design and Tuning Copyright 2011 Pearson Education, Inc. Publishing as Pearson Addison-Wesley 1. Physical Database Design in Relational Databases (1) Factors that Influence

### 10. What SQL command can be used to add columns to a table? a. MODIFY TABLE TableName ADD COLUMN ColumnName b. MODIFY TABLE TableName ADD ColumnName c

1. The first generation of DBMS is represented by systems a. Hierarchical and CODASYL systems. b. Relational model c. Network model 2. Which of the following SQL statements are helpful in database redesign?

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

### Chapter 5 More SQL: Complex Queries, Triggers, Views, and Schema Modification

Chapter 5 More SQL: Complex Queries, Triggers, Views, and Schema Modification Copyright 2011 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Chapter 5 Outline More Complex SQL Retrieval Queries

Advanced Oracle SQL Tuning Seminar content technical details 1) Understanding Execution Plans In this part you will learn how exactly Oracle executes SQL execution plans. Instead of describing on PowerPoint

### Performance Evaluation of Natural and Surrogate Key Database Architectures

Performance Evaluation of Natural and Surrogate Key Database Architectures Sebastian Link 1, Ivan Luković 2, Pavle ogin *)1 1 Victoria University of Wellington, Wellington, P.O. Box 600, New Zealand sebastian.link@vuw.ac.nz

### EFFICIENT EXTERNAL SORTING ON FLASH MEMORY EMBEDDED DEVICES

ABSTRACT EFFICIENT EXTERNAL SORTING ON FLASH MEMORY EMBEDDED DEVICES Tyler Cossentine and Ramon Lawrence Department of Computer Science, University of British Columbia Okanagan Kelowna, BC, Canada tcossentine@gmail.com

### Big Data Technology Map-Reduce Motivation: Indexing in Search Engines

Big Data Technology Map-Reduce Motivation: Indexing in Search Engines Edward Bortnikov & Ronny Lempel Yahoo Labs, Haifa Indexing in Search Engines Information Retrieval s two main stages: Indexing process

### MS SQL Performance (Tuning) Best Practices:

MS SQL Performance (Tuning) Best Practices: 1. Don t share the SQL server hardware with other services If other workloads are running on the same server where SQL Server is running, memory and other hardware

### Database Design Patterns. Winter 2006-2007 Lecture 24

Database Design Patterns Winter 2006-2007 Lecture 24 Trees and Hierarchies Many schemas need to represent trees or hierarchies of some sort Common way of representing trees: An adjacency list model Each

### Efficient Iceberg Query Evaluation for Structured Data using Bitmap Indices

Proc. of Int. Conf. on Advances in Computer Science, AETACS Efficient Iceberg Query Evaluation for Structured Data using Bitmap Indices Ms.Archana G.Narawade a, Mrs.Vaishali Kolhe b a PG student, D.Y.Patil

### B-Trees. Algorithms and data structures for external memory as opposed to the main memory B-Trees. B -trees

B-Trees Algorithms and data structures for external memory as opposed to the main memory B-Trees Previous Lectures Height balanced binary search trees: AVL trees, red-black trees. Multiway search trees:

### Why Query Optimization? Access Path Selection in a Relational Database Management System. How to come up with the right query plan?

Why Query Optimization? Access Path Selection in a Relational Database Management System P. Selinger, M. Astrahan, D. Chamberlin, R. Lorie, T. Price Peyman Talebifard Queries must be executed and execution

### Storing Data: Disks and Files

Storing Data: Disks and Files [R&G] Chapter 9 CS 4320 1 Data on External Storage Disks: Can retrieve random page at fixed cost But reading several consecutive pages is much cheaper than reading them in

### Suppose you are accessing elements of an array: ... or suppose you are dereferencing pointers:

CSE 100: B-TREE Memory accesses Suppose you are accessing elements of an array: if ( a[i] < a[j] ) {... or suppose you are dereferencing pointers: temp->next->next = elem->prev->prev;... or in general

### The Relational Algebra

The Relational Algebra The relational algebra is very important for several reasons: 1. it provides a formal foundation for relational model operations. 2. and perhaps more important, it is used as a basis

### Chapter 5. SQL: Queries, Constraints, Triggers

Chapter 5 SQL: Queries, Constraints, Triggers 1 Overview: aspects of SQL DML: Data Management Language. Pose queries (Ch. 5) and insert, delete, modify rows (Ch. 3) DDL: Data Definition Language. Creation,

### SQL Tables, Keys, Views, Indexes

CS145 Lecture Notes #8 SQL Tables, Keys, Views, Indexes Creating & Dropping Tables Basic syntax: CREATE TABLE ( DROP TABLE ;,,..., ); Types available: INT or INTEGER REAL or FLOAT CHAR( ), VARCHAR( ) DATE,

### Computer Security: Principles and Practice

Computer Security: Principles and Practice Chapter 5 Database Security First Edition by William Stallings and Lawrie Brown Lecture slides by Lawrie Brown Database Security 1 Relational Databases constructed

### University of Wisconsin. yannis@cs.wisc.edu. Imagine yourself standing in front of an exquisite buæet ælled with numerous delicacies.

Query Optimization Yannis E. Ioannidis æ Computer Sciences Department University of Wisconsin Madison, WI 53706 yannis@cs.wisc.edu 1 Introduction Imagine yourself standing in front of an exquisite buæet

### Physical Data Organization

Physical Data Organization Database design using logical model of the database - appropriate level for users to focus on - user independence from implementation details Performance - other major factor

### The Classical Architecture. Storage 1 / 36

1 / 36 The Problem Application Data? Filesystem Logical Drive Physical Drive 2 / 36 Requirements There are different classes of requirements: Data Independence application is shielded from physical storage

### Data Management for Data Science

Data Management for Data Science Database Management Systems: Access file manager and query evaluation Maurizio Lenzerini, Riccardo Rosati Dipartimento di Ingegneria informatica automatica e gestionale

### Relational Databases

Relational Databases Jan Chomicki University at Buffalo Jan Chomicki () Relational databases 1 / 18 Relational data model Domain domain: predefined set of atomic values: integers, strings,... every attribute

### www.gr8ambitionz.com

Data Base Management Systems (DBMS) Study Material (Objective Type questions with Answers) Shared by Akhil Arora Powered by www. your A to Z competitive exam guide Database Objective type questions Q.1

### In-Memory Database: Query Optimisation. S S Kausik (110050003) Aamod Kore (110050004) Mehul Goyal (110050017) Nisheeth Lahoti (110050027)

In-Memory Database: Query Optimisation S S Kausik (110050003) Aamod Kore (110050004) Mehul Goyal (110050017) Nisheeth Lahoti (110050027) Introduction Basic Idea Database Design Data Types Indexing Query

### Multi-dimensional index structures Part I: motivation

Multi-dimensional index structures Part I: motivation 144 Motivation: Data Warehouse A definition A data warehouse is a repository of integrated enterprise data. A data warehouse is used specifically for

### Lecture 1: Data Storage & Index

Lecture 1: Data Storage & Index R&G Chapter 8-11 Concurrency control Query Execution and Optimization Relational Operators File & Access Methods Buffer Management Disk Space Management Recovery Manager

### Database Management Systems. Chapter 1

Database Management Systems Chapter 1 Database Management Systems 3ed, R. Ramakrishnan and J. Gehrke 2 What Is a Database/DBMS? A very large, integrated collection of data. Models real-world scenarios

### Raima Database Manager Version 14.0 In-memory Database Engine

+ Raima Database Manager Version 14.0 In-memory Database Engine By Jeffrey R. Parsons, Senior Engineer January 2016 Abstract Raima Database Manager (RDM) v14.0 contains an all new data storage engine optimized

### DATABASDESIGN FÖR INGENJÖRER - 1DL124

1 DATABASDESIGN FÖR INGENJÖRER - 1DL124 Sommar 2005 En introduktionskurs i databassystem http://user.it.uu.se/~udbl/dbt-sommar05/ alt. http://www.it.uu.se/edu/course/homepage/dbdesign/st05/ Kjell Orsborn

### The Relational Model. Why Study the Relational Model? Relational Database: Definitions. Chapter 3

The Relational Model Chapter 3 Database Management Systems 3ed, R. Ramakrishnan and J. Gehrke 1 Why Study the Relational Model? Most widely used model. Vendors: IBM, Informix, Microsoft, Oracle, Sybase,

### 1. SELECT DISTINCT f.fname FROM Faculty f, Class c WHERE f.fid = c.fid AND c.room = LWSN1106

Database schema: Department(deptid, dname, location) Student(snum, sname, deptid, slevel, age) Faculty(fid, fname, deptid) Class(cname, time, room, fid) Enrolled(snum, cname) SQL queries: 1. Get the names

### Question 1. Relational Data Model [17 marks] Question 2. SQL and Relational Algebra [31 marks]

EXAMINATIONS 2005 MID-YEAR COMP 302 Database Systems Time allowed: Instructions: 3 Hours Answer all questions. Make sure that your answers are clear and to the point. Write your answers in the spaces provided.

### Relational Model CENG 351 1

Relational Model CENG 351 1 Relational Database: Definitions Relational database: a set of relations Relation: made up of 2 parts: Instance : a table, with rows and columns. #Rows = cardinality, #fields

### 1 11/11/2002. σ P.Dnum=D.Dnum and D.Dmgrssn=E.SSN and P.Plocation= Stafford 3 11/11/ /11/2002

376a. Database Design Dept. of Computer Science Vassar College http://www.cs.vassar.edu/~cs376 Class 17 Query optimization algorithms Query tree A representation of a select statement Canonical form of

### Microsoft MTA Database Administration Fundamentals

1 Microsoft - 98-364 MTA Database Administration Fundamentals QUESTION: 1 John works as a Database Administrator for Bluewell Inc. The company has a SQL Server database. A table in the database has a candidate

### Query Processing. Q Query Plan. Example: Select B,D From R,S Where R.A = c S.E = 2 R.C=S.C. Himanshu Gupta CSE 532 Query Proc. 1

Q Query Plan Query Processing Example: Select B,D From R,S Where R.A = c S.E = 2 R.C=S.C Himanshu Gupta CSE 532 Query Proc. 1 How do we execute query? One idea - Do Cartesian product - Select tuples -

### Multi-Way Search Trees (B Trees)

Multi-Way Search Trees (B Trees) Multiway Search Trees An m-way search tree is a tree in which, for some integer m called the order of the tree, each node has at most m children. If n

### Previous Lectures. B-Trees. External storage. Two types of memory. B-trees. Main principles

B-Trees Algorithms and data structures for external memory as opposed to the main memory B-Trees Previous Lectures Height balanced binary search trees: AVL trees, red-black trees. Multiway search trees: