Physical DB Design Jianlin Feng School of Software SUN YAT-SEN UNIVERSITY courtesy of Joe Hellerstein for some slides.

Slides:



Advertisements
Similar presentations
Physical Database Design and Tuning R&G - Chapter 20 Although the whole of this life were said to be nothing but a dream and the physical world nothing.
Advertisements

Database Tuning. Overview v After ER design, schema refinement, and the definition of views, we have the conceptual and external schemas for our database.
Database Management Systems 3ed, R. Ramakrishnan and J. Gehrke1 Physical Database Design Section Chapter 20.
1 Overview of Indexing Chapter 8 – Part II. 1. Introduction to indexing 2. First glimpse at indices and workloads.
Overview of Storage and Indexing
Manajemen Basis Data Pertemuan 7 Matakuliah: M0264/Manajemen Basis Data Tahun: 2008.
1 Physical Design: Indexing Yanlei Diao UMass Amherst Feb 13, 2006 Slides Courtesy of R. Ramakrishnan and J. Gehrke.
DB performance tuning using indexes Section 8.5 and Chapters 20 (Raghu)
Physical Database Design R&G Chapter 16 Lecture 26.
Database Management Systems 3ed, R. Ramakrishnan and J. Gehrke1 Overview of Storage and Indexing Chapter 8 “How index-learning turns no student pale Yet.
File Organizations and Indexing Lecture 5 R&G Chapter 8 "If you don't find it in the index, look very carefully through the entire catalogue." -- Sears,
1 Physical Database Design and Tuning Module 5, Lecture 3.
Database Management Systems 3ed, R. Ramakrishnan and J. Gehrke1 Physical Database Design Chapter 20.
ACS-4902 Ron McFadyen Chapter 15 Algorithms for Query Processing and Optimization.
Murali Mani Overview of Storage and Indexing (based on slides from Wisconsin)
Database Management Systems 3ed, R. Ramakrishnan and J. Gehrke1 Overview of Storage and Indexing Chapter 8 “How index-learning turns no student pale Yet.
1 Overview of Indexing Chapter 8 – Part II. 1. Introduction to indexing 2. First glimpse at indices and workloads.
Physical Database Design and Tuning R&G - Chapter 20 Although the whole of this life were said to be nothing but a dream and the physical world nothing.
Database Management Systems 3ed, R. Ramakrishnan and J. Gehrke1 Overview of Storage and Indexing Chapter 8.
Database Systems An Overview of Storage and Indexing
1 IT420: Database Management and Organization Storage and Indexing 14 April 2006 Adina Crăiniceanu
Physical Database Design and Database Tuning, R. Ramakrishnan and J. Gehrke, modified by Ch. Eick 1 Physical Database Design Part II.
Database Management Systems 3ed, R. Ramakrishnan and J. Gehrke1 Overview of Implementing Relational Operators and Query Evaluation Chapter 12.
Database Management Systems 3ed, R. Ramakrishnan and J. Gehrke1 Physical Database Design and Tuning.
Database Tuning Prerequisite Cluster Index B+Tree Indexing Hash Indexing ISAM (indexed Sequential access)
Database Management Systems 3ed, R. Ramakrishnan and J. Gehrke1 Queries, Database Design, Constraint Enforcement Specify Schema + specify constraints.
Physical Database Design I, Ch. Eick 1 Physical Database Design I About 25% of Chapter 20 Simple queries:= no joins, no complex aggregate functions Focus.
Storage and Indexing1 Overview of Storage and Indexing.
1 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 ( )
Database Management Systems 3ed, R. Ramakrishnan and J. Gehrke1 Physical Database Design and Tuning Chapter 20.
H.Lu/HKUST L03: Physical Database Design (I)  Introduction  Index Selection  Partitioning & denormalization.
Database Management Systems 3ed, R. Ramakrishnan and J. Gehrke1 Overview of Storage and Indexing Chapter 8.
1 Overview of Storage and Indexing Chapter 8. 2 Data on External Storage  Disks: Can retrieve random page at fixed cost  But reading several consecutive.
Overview of Storage and Indexing Content based on Chapter 4 Database Management Systems, (Third Edition), by Raghu Ramakrishnan and Johannes Gehrke. McGraw.
Database Management Systems 3ed, R. Ramakrishnan and J. Gehrke1 Overview of Storage and Indexing Chapter 8 “How index-learning turns no student pale Yet.
1 Database Systems ( 資料庫系統 ) October 4, 2004 Lecture #4 By Hao-hua Chu ( 朱浩華 )
Database Management Systems 3ed, R. Ramakrishnan and J. Gehrke1 Overview of Storage and Indexing Chapter 8 “If you don’t find it in the index, look very.
1 Database Systems ( 資料庫系統 ) October 29/31, 2007 Lecture #6.
Physical Database Design I, Ch. Eick 1 Physical Database Design I Chapter 16 Simple queries:= no joins, no complex aggregate functions Focus of this Lecture:
Database Management Systems 3ed, R. Ramakrishnan and J. Gehrke1 Overview of Storage and Indexing Chapter 8.
More Optimization Exercises. Block Nested Loops Join Suppose there are B buffer pages Cost: M + ceil (M/(B-2))*N where –M is the number of pages of R.
YV - B+ Trees and Physical Design 326 Kεφάλαιο 8 ISAM και B-Δέντρα Φυσικός Σχεδιασμός για Βάσεις Δεδομένων.
Database Management Systems 3ed, R. Ramakrishnan and J. Gehrke1 Overview of Storage and Indexing Chapter 8.
Database Management Systems 3ed, R. Ramakrishnan and J. Gehrke1 Physical Database Design Section Chapter 20.
Database Management Systems 3ed, R. Ramakrishnan and J. Gehrke1 Overview of Storage and Indexing Chapter 8.
1 Overview of Storage and Indexing Chapter 8. 2 Review: Architecture of a DBMS  A typical DBMS has a layered architecture.  The figure does not show.
Database Management Systems 3ed, R. Ramakrishnan and J. Gehrke1 Overview of Storage and Indexing Chapter 8 “If you don’t find it in the index, look very.
1 CS122A: Introduction to Data Management Lecture #15: Physical DB Design Instructor: Chen Li.
CS522 Advanced database Systems Huiping Guo Department of Computer Science California State University, Los Angeles 3. Overview of data storage and indexing.
Record Storage, File Organization, and Indexes
Overview of Implementing Relational Operators Query Evaluation
Lecture 12 Lecture 12: Indexing.
Hashing Chapter 11.
Overview of Storage and Indexing
CS222: Principles of Data Management Notes #09 Indexing Performance
Physical Database Design
Chapter 8 – Part II. A glimpse at indices and workloads
Overview of Storage and Indexing
CS222P: Principles of Data Management Notes #09 Indexing Performance
Database Systems October 20, 2008 Lecture #6.
Overview of Storage and Indexing
File Storage and Indexing
Overview of Storage and Indexing
Physical Database Design and Tuning
Physical Database Design
Overview of Storage and Indexing
Physical Database Design
CS222/CS122C: Principles of Data Management UCI, Fall 2018 Notes #08 Comparisons of Indexes and Indexing Performance Instructor: Chen Li.
Overview of Storage and Indexing
Physical Database Design and Tuning
Presentation transcript:

Physical DB Design Jianlin Feng School of Software SUN YAT-SEN UNIVERSITY courtesy of Joe Hellerstein for some slides

Physical DB Design Query optimizer does what it can to use indices, clustering etc. DataBase Administrator (DBA) is expected to set up physical design well. Good DBAs understand query optimizers very well.

One Key Decision: Indexes Which tables Which field(s) should be the search key? Multiple indexes? Clustering?

Index Selection One approach:  Consider most important queries in turn.  Consider best plan using the current indexes  See if better plan is possible with an additional index.  If so, create it. But consider impact on updates!  Indexes can make queries go faster, updates slower.  Require disk space, too.

Issues to Consider in Index Selection Attributes mentioned in a WHERE clause are candidates for index search keys.  Range conditions are sensitive to clustering  Exact match conditions don’t require clustering Or do they???? :-) Choose indexes that benefit many queries NOTE: only one index can be clustered per relation!  So choose it wisely!

Example 1 B+ tree index on D.dname supports ‘Toy’ selection.  Given this, index on D.dno is not needed. B+ tree on E.dno allows us to get matching (inner) Emp tuples for each selected (outer) Dept tuple. What if WHERE included: ``... AND E.age=25’’ ?  Could retrieve Emp tuples using index on E.age, then join with Dept tuples satisfying dname selection. Comparable to strategy that used E.dno index.  So, if E.age index is already created, this query provides much less motivation for adding an E.dno index. SELECT E.ename, D.mgr FROM Emp E, Dept D WHERE E.dno=D.dno AND D.dname=‘Toy’

Example 2 All selections are on Emp so it should be the outer relation in any Index NL join.  Suggests that we build a B+ tree index on D.dno. What index should we build on Emp?  B+ tree on E.sal could be used, OR an index on E.hobby could be used.  Only one of these is needed, and which is better depends upon the selectivity of the conditions. As a rule of thumb, equality selections more selective than range selections. Have to understand optimizers to get this right! SELECT E.ename, D.mgr FROM Emp E, Dept D WHERE E.sal BETWEEN AND AND E.hobby=‘Stamps’ AND E.dno=D.dno

Examples of Clustering B+ tree index on E.age can be used to get qualifying tuples.  How selective is the condition?  Is the index clustered? Consider the GROUP BY query.  If many tuples have E.age > 10, using E.age index and sorting the retrieved tuples may be costly.  Clustered E.dno index may be better! Equality queries and duplicates:  Clustering on E.hobby helps! SELECT E.dno FROM Emp E WHERE E.age>40 SELECT E.dno, COUNT (*) FROM Emp E WHERE E.age>10 GROUP BY E.dno SELECT E.dno FROM Emp E WHERE E.hobby=Stamps