Presentation is loading. Please wait.

Presentation is loading. Please wait.

Announcements Program 1 on web site: due next Friday Today: buffer replacement, record and block formats Next Time: file organizations, start Chapter 14.

Similar presentations


Presentation on theme: "Announcements Program 1 on web site: due next Friday Today: buffer replacement, record and block formats Next Time: file organizations, start Chapter 14."— Presentation transcript:

1 Announcements Program 1 on web site: due next Friday Today: buffer replacement, record and block formats Next Time: file organizations, start Chapter 14 (indexes) Office hours change: –Old office hours Mon 10-11, Thur 1:30-2:30 –New office hours Mon 10-11, Thur 2-3 Opportunity to replace lowest HW (not program) –Create PPT slides of worked examples

2 Open questions from last time When to write dirty pages? –Dirty pages may be kept in buffer pool without being written to disk immediately but, –At conclusion of transaction the DBMS log (aka journal) is forced to disk (see Chapter 17) How much does OS need to be concerned with hard drive architecture? –I am not certain but I would think not much Why does pin count for a frame exceed 1? –See email

3 Buffer Replacement Policy When new block is brought into full buffer pool a frame with pin_cnt = 0 is chosen for replacement Possible policies –Least Recently Used –Most Recently Used –First In First Out (FIFO) LRU is most common, but can be poor for some access patterns (sequential flooding) If no blocks have pin_count = 0, return an error

4 Buffer Replacement Example

5 Sequential Flooding

6 Sequential Flooding Example BufMgr has N frames DB File has N+1 blocks If file is repeatedly scanned, I/O is needed on almost every page access

7 Records and Files

8 Query Optimization Relational Operators Disk Space Management Buffer Management Files and Access Methods So far we have reading and writing whole blocks. Now we will discuss how an RDBMS organizes data within a block

9 Records Higher levels see data as a collection of records: struct employee{ char name[30]; char ssn[9]; int salary; int job_code; char deparment[20]; }; example of a record description in C++

10 File A file is a collection of records that (in general) spans multiple blocks record 1record 2record 3 record 4record 5record 6 record N-1record N block 1 of file block 2 of file block M of file file with M blocks

11 We are primarily concerned with how these organizations impact the performance of various file operations Some Issues With Records and Files Record format –fixed length Vs variable length Record organization within a block –Packed, unpacked Record organization within file –ordered Vs unordered

12 Some Common Operations on Files Scan –fetch all records in the file Search with Equality Selection –find student with studentId = 85 Search with Range Selection –find all student with GPA between 3.0 and 3.3 Insert –add a record to the file Delete –Remove a record given its RID

13 Record Format Fixed length record format Variable length record formats

14 Reasons for variable length records Variable length fields (most common) Repeating groups Optional fields Mixed record types

15 Block Formats Figure 3.5 for Packed and Unpacked Figure 3.6 Directory of Slots

16 File Organizations (overview) Heap Files –Unordered random sequence of records Ordered Files –Records are ordered by some field (or combination of fields) Hashed Files –A hash function used to quickly find records on some key.

17 Record Format Spanned record organization is a more efficient use of space, but accessing a record may require multiple I/O operation (may be unavoidable for large records).

18 Allocating files on disk contiguous allocation linked allocation hybrid of contiguous and linked


Download ppt "Announcements Program 1 on web site: due next Friday Today: buffer replacement, record and block formats Next Time: file organizations, start Chapter 14."

Similar presentations


Ads by Google