Midterm Review – Part I ( Disk, Buffer and Index )

Slides:



Advertisements
Similar presentations
Tutorial 8 CSI 2132 Database I. Exercise 1 Both disks and main memory support direct access to any desired location (page). On average, main memory accesses.
Advertisements

1 Introduction to Database Systems CSE 444 Lectures 19: Data Storage and Indexes November 14, 2007.
1 Overview of Storage and Indexing Yanlei Diao UMass Amherst Feb 13, 2007 Slides Courtesy of R. Ramakrishnan and J. Gehrke.
1 Lecture 20: Indexes Friday, February 25, Outline Representing data elements (12) Index structures (13.1, 13.2) B-trees (13.3)
The Relational Model (cont’d) Introduction to Disks and Storage CS 186, Spring 2007, Lecture 3 Cow book Section 1.5, Chapter 3 (cont’d) Cow book Chapter.
1 Indexing Structures for Files. 2 Basic Concepts  Indexing mechanisms used to speed up access to desired data without having to scan entire.
File Organizations and Indexing Lecture 4 R&G Chapter 8 "If you don't find it in the index, look very carefully through the entire catalogue." -- Sears,
1.1 CAS CS 460/660 Introduction to Database Systems File Organization Slides from UC Berkeley.
DBMS Internals: Storage February 27th, Representing Data Elements Relational database elements: A tuple is represented as a record CREATE TABLE.
Database Management Systems, R. Ramakrishnan and J. Gehrke1 Tree-Structured Indexes Chapter 9.
Tree-Structured Indexes. Range Searches ``Find all students with gpa > 3.0’’ –If data is in sorted file, do binary search to find first such student,
Layers of a DBMS Query optimization Execution engine Files and access methods Buffer management Disk space management Query Processor Query execution plan.
Storage and Indexing February 26 th, 2003 Lecture 19.
Indexing - revisited CS 186, Fall 2012 R & G Chapter 8.
1 Physical Data Organization and Indexing Lecture 14.
Physical Storage Susan B. Davidson University of Pennsylvania CIS330 – Database Management Systems November 20, 2007.
Index tuning-- B+tree. overview Overview of tree-structured index Indexed sequential access method (ISAM) B+tree.
Spring 2003 ECE569 Lecture 05.1 ECE 569 Database System Engineering Spring 2003 Yanyong Zhang
CPSC 404 Assignment #1, Winter 2008 Term 2. Due: Wednesday, Feb 4, by 5 pm. Laks V.S. Lakshmanan.
File Organizations and Indexing
Spring 2004 ECE569 Lecture 05.1 ECE 569 Database System Engineering Spring 2004 Yanyong Zhang
Storage and Indexing. How do we store efficiently large amounts of data? The appropriate storage depends on what kind of accesses we expect to have to.
DMBS Internals I February 24 th, What Should a DBMS Do? Store large amounts of data Process queries efficiently Allow multiple users to access the.
Database Management Systems 3ed, R. Ramakrishnan and J. Gehrke1 External Sorting Chapter 13.
CS4432: Database Systems II
CS 405G: Introduction to Database Systems Instructor: Jinze Liu Fall 2007.
Database Management Systems, R. Ramakrishnan and J. Gehrke1 File Organizations and Indexing Chapter 8 Jianping Fan Dept of Computer Science UNC-Charlotte.
1 Lecture 16: Data Storage Wednesday, November 6, 2006.
Database Applications (15-415) DBMS Internals- Part III Lecture 13, March 06, 2016 Mohammad Hammoud.
Database Management Systems 3ed, R. Ramakrishnan and J. Gehrke1 Overview of Storage and Indexing Chapter 8.
Storing Data: Disks and Files Memory Hierarchy Primary Storage: main memory. fast access, expensive. Secondary storage: hard disk. slower access,
The very Essentials of Disk and Buffer Management.
CS222: Principles of Data Management Lecture #4 Catalogs, Buffer Manager, File Organizations Instructor: Chen Li.
CS522 Advanced database Systems
Module 11: File Structure
CS522 Advanced database Systems
Lecture 16: Data Storage Wednesday, November 6, 2006.
Indexing ? Why ? Need to locate the actual records on disk without having to read the entire table into memory.
CS522 Advanced database Systems
External Sorting Chapter 13
CS222/CS122C: Principles of Data Management Lecture #3 Heap Files, Page Formats, Buffer Manager Instructor: Chen Li.
Database Management Systems (CS 564)
Database Management Systems (CS 564)
Lecture 11: DMBS Internals
Lecture 10: Buffer Manager and File Organization
Database Management Systems (CS 564)
Database Applications (15-415) DBMS Internals- Part III Lecture 15, March 11, 2018 Mohammad Hammoud.
Disk Storage, Basic File Structures, and Buffer Management
Disk storage Index structures for files
Database Management Systems (CS 564)
Introduction to Database Systems File Organization and Indexing
Introduction to Database Systems
External Sorting Chapter 13
Lecture 21: Indexes Monday, November 13, 2000.
Lecture 19: Data Storage and Indexes
CS222/CS122C: Principles of Data Management Lecture #4 Catalogs, File Organizations Instructor: Chen Li.
Database Management Systems (CS 564)
Lecture 28: Index 3 B+ Trees
CSE 544: Lecture 11 Storing Data, Indexes
Indexing 1.
Indexing Lecture 15.
Storage and Indexing.
CS222p: Principles of Data Management Lecture #4 Catalogs, File Organizations Instructor: Chen Li.
General External Merge Sort
Introduction to Database Systems CSE 444 Lectures 19: Data Storage and Indexes May 16, 2008.
Indexing February 28th, 2003 Lecture 20.
Lecture 20: Indexes Monday, February 27, 2006.
External Sorting Chapter 13
CS222/CS122C: Principles of Data Management UCI, Fall 2018 Notes #05 Index Overview and ISAM Tree Index Instructor: Chen Li.
CS222/CS122C: Principles of Data Management UCI, Fall 2018 Notes #03 Row/Column Stores, Heap Files, Buffer Manager, Catalogs Instructor: Chen Li.
Presentation transcript:

Midterm Review – Part I ( Disk, Buffer and Index ) CS186 Spring 03

Content Quick Review Questions from You Disk Example Buffer Example B+ Tree Example (1)(2) 2018/12/1

Quick Review Disk Components of disk Disk access time seek + rotation delay + transfer Disk space management Heap file (list / page directory) Record format (fixed length / variable length) Page format - fixed / variable (slot directory) 2018/12/1

Quick Review – cont. Buffer Management Buffer pool pin / unpin, dirty, etc. Buffer replacement policy (LRU, MRU, Clock) How they works? Advantage? Problem? e.g. sequential flooding in LRU 2018/12/1

Quick Review – cont. File Storage Heap / Sorted / Clustered file I/O cost of operation (see next page) Basics about indexes Why use? Speed up selection on keys. Classification Clustered vs. Unclustered Related to cost! How indexes are organized? Pros and cons? 2018/12/1

Quick Review – cont. Heap File Sorted File Clustered File Empirical study show that pages are about 67% occupancy.  The number of physical data pages is about 1.5B Heap File Sorted File Clustered File Scan all records BD 1.5 BD Equality Search 0.5 BD (log2B) * D (logF1.5B) * D Range Search [(log2B) + #match pg]*D [(logF1.5B) + #match pg]*D Insert 2D ((log2B)+B)*D ((logF1.5B)+1) * D Delete 0.5BD + D ((log2B)+B)*D (because R,W 0.5) Ignore the case when leaf is full, so only one write here. 2 * 0.5BD (read+write) for moving the later parts of the file B: The number of data pages D: (Average) time to read or write disk page 2018/12/1

Quick Review – cont. Tree Structured Index ISAM B+ Tree How the index is organized? Know about how to insert, delete … B+ Tree Features (pros and cons) Familiar with bulk load, insert, delete … Simple computation using fanout, order, height … 2018/12/1

Questions From You For variable-length records page format (lecture 3), do we pack on removal? Doesn't seem like it would be an easy or cheap operation... But how else can we reclaim free space? Do not pack each time. Pack the space only when not enough free space. Dense vs. sparse index? Not in the coverage of this semester 2018/12/1

Disk Example (Fall 1999 Midterm) Consider a disk with a sector size of 512 bytes, 100 sectors per track. Given a rotational speed of 7200 revolutions per second, what is the maximum rotational delay to the start of a sector? Assuming that one track of data can be transferred per revolution, what is the transfer rate? Maximum rotational delay:1/7200 sec Average rotational delay: 0.5*(1/7200) Transfer rate: 512*100*7200 bytes/sec. 2018/12/1

Buffer Example ( Fall 1999 Midterm ) Assume that in the CUSTOMERS table, records are much larger than shown in the table on the page – in fact, each record fits in exactly one page, so the CUSTOMERS table is 5 pages long. And also assume that there is room for only two buffers – that is, there are two buffer frames – in memory, and that these buffers start out empty. Is LRU or MRU a better strategy if we are reading the CUSTOMERS records in the order: Cid = 1, 1, 3, 4, 3, 1, 2. Explain your answer. 2018/12/1

Buffer Example – cont. 1, 1, 3, 4, 3, 1, 2 LRU 1 4 3 2 MRU 1 2 3 4 2018/12/1

B+ Tree Example (1) (Fall 2002 Final) For each of the following B+ Trees, decide whether it is a valid B+ Tree (i.e., one that could exist after numerous inserts and deletes) or if it is invalid. Circle your choice, and if it is invalid, describe in one sentence the single main reason why. The trees follow all rules in the book including merging on delete. All of the trees are of order d=2. 2018/12/1

B+ Tree Example (1) – cont. Valid 2018/12/1

B+ Tree Example (1) – cont. Invalid 2018/12/1

B+ Tree Example (1) – cont. Valid 2018/12/1

B+ Tree Example (1) – cont. Invalid 2018/12/1

B+ Tree Example (1) – cont. Invalid 2018/12/1

B+ Tree Example (1) – cont. Invalid 2018/12/1

B+ Tree Example (2) (Spring 2002 Midterm) Consider a B+ tree containing the elements 2, 4, 8, 9, 11, 12, 13, 14, 16, 17, 18, 20. The tree has order d = 2. This means that internal nodes have at least 2 entries and 3 pointers and at most 4 entries and 5 pointers; leaf nodes have at least 2 entries and at most 4 entries. 2018/12/1

B+ Tree Example (2) – cont. bulk-load (2, 4, 8, 9, 11, 12, 13, 14, 16, 17, 18, 20) 2018/12/1

B+ Tree Example (2) – cont. Based on your original tree from above, what is the minimum number of deletions required to change the tree into one single leaf node? 2018/12/1