Download presentation
Presentation is loading. Please wait.
Published byClaude Ross Modified over 8 years ago
1
Announcements Today –RAID –Begin Indexes Program 1 due Friday –Office Hours today 2-3 pm –I’ll have limited email contact over the weekend –later today I’ll give info for turning in the program
2
RAID Redundant Arrays of Inexpensive Disks Goal of RAID is to even out rates of disk improvements (small) w/ those in RAM and CPU RAID use multiple physical disks to behave as a single logical disk
3
Data Striping Data striping stores data across multiple disks There are different granularities bit level granularity block level granularity
4
Naïve Striping Reduces Reliability Likelihood of failure increases w/ # of disks –Mirroring, error correcting codes are used to increase reliability at the expense of speed But is this statement correct? –(from Section 13.10.1) “For an array of n disks, the likelihood of failure is n times as much as that for one disk. Hence, if the MTTF of a disk drive is 200,000 hours (22.8 years), that of a bank of 100 disk drives becomes only 2000 hours (83 days)”
5
RAID Organizations balance speed and reliability
6
Indexing Structures for Files Chapter 14
7
“If you don’t find it in the index, look very carefully through the whole catalog” - Sears, Roebuck and Co. consumers’ Guide, 1897
8
Indexes provide alternative access paths Query: Find record for student “Troy Allen” Index on “name” Step 1: query the index for the RID for the record (hopefully a few IOs) Step 2: query the buffer manager for the appropriate block (1 IO) RID = (3438, 9)“Troy Allen”
9
An index Is a collection of data entries Is associated with a specific file Is associated with a specific field called the indexing field (sometimes called the search or key field) Contains data so that BlkIDs (or RIDs) whose indexing fields match a given value can be found quickly
10
Some Considerations What is the organization of the underlying file –Eg, is it ordered on the search key? Are the values of the indexing field unique (ie, is the indexing field a key field)? How are the data entries of the index organized? –Example: make index a hashed file on index field where each record contains (value, RID) pairs
11
Some Definitions primary index: an index on the ordering key field of a ordered file secondary index: an index on any non-ordering field of the file clustered index: an index whose data entries are ordered in the same way as the underlying file dense index: has an index entry for every search key value (and hence every record) in the data file. sparse index: has index entries for only some of the search values
12
Primary Index A primary index is an ordered file of pairs A record is stored for each block in the file. The records for Blk B contains the value of the first record on that block
14
Cost of Maintaining a Clustered Primary Index Inserting of record in the ordered file (already expensive) may require significant updates to the index –Why is this?
15
Clustering Indexes Recall a clustering index is an index on a non-key ordering field of an ordered file What do we need to store in the index? –as with pri idx, pairs –but now we need a record in the index for every unique value of the indexing key –the blk field of the index gives the first block that a record for value appears on
17
one way to handle the “insert” problem of ordered files
18
Secondary Indexes An index on field that is not the ordering field of the underlying file The indexing field may or may not be a key field for the file What is the format for records in a secondary index on a key field? How many records are needed?
20
More Secondary Indexes What if the indexing field is not a key field? –Option 1: Keep index entry for each record, so we will have multiple index entries for each value –Option 2: Have one record / value and store a “RID list” for each value. Thus the index records are variable length records –Option 3: Mixed type of index records (next slide)
22
Properties of Index Types
23
SQL to Create an Index CREATE INDEX idxAge ON Students WITH STRUCTURE = BTREE KEY = (age)
24
Next time: Multilevel indexes
Similar presentations
© 2024 SlidePlayer.com. Inc.
All rights reserved.