Presentation is loading. Please wait.

Presentation is loading. Please wait.

Indexing By: Arnold Mesa. Indexing You can think of an index to a file like a catalogue to a library.

Similar presentations


Presentation on theme: "Indexing By: Arnold Mesa. Indexing You can think of an index to a file like a catalogue to a library."— Presentation transcript:

1 Indexing By: Arnold Mesa

2 Indexing You can think of an index to a file like a catalogue to a library

3 There are two kinds... 4 Ordered Indices - sorted ordering of the values. 4 Hash Indices - a uniform distribution of values across a range of buckets. The distribution is based on a hash function.

4 Key Concepts 4 Access Types - types of access that are supported efficiently 4 Access Time - time it takes to access a particular data item 4 Insertion Time - time it takes to insert a data item 4 Deletion Time - time it takes to delete a data item 4 Space Overhead - additional space occupied by an index structure

5 4 There are two kinds of ordered indices –Dense Index - An index record appears for every search-key value in the file. The index record contains the search-key value and a pointer to the first data record. The rest of the records with the same search key-value would be sequentially stored after the first record. –Sparse Index - An index record appears for only some of the search key values. So you have a smaller number of index records. Each index contains a search key and a pointer to the first record, as with the dense index.

6 234Hotel SofitelA-212 321HiltonB-321 389Hilton C-002 396Hilton A-322 112WestinC-034 253Westin B-219 501MarriotB-069 532MarriotC-304 221The RitzA-007 Hotel Sofitel Hilton Westin Marriot The Ritz Dense Index

7 234Hotel SofitelA-212 321HiltonB-321 389Hilton C-002 396Hilton A-322 112WestinC-034 253Westin B-219 501MarriotB-069 532MarriotC-304 221The RitzA-007 Hotel Sofitel Westin The Ritz Sparse Tree

8 234Hotel SofitelA-212 321HiltonB-321 389Hilton C-002 396Hilton A-322 112WestinC-034 253Westin B-219 501MarriotB-069 532MarriotC-304 221The RitzA-007 Hotel Sofitel Westin The Ritz Suppose we want to find the Marriot #532...

9 Efficiency Issues 4 Even if we use a sparse index, the index itself may become too large for efficient processing 4 If an index is sufficiently small to be kept in main memory, the search time would be low 4 If the index is large that is kept on disk, a search may require several disk block reads

10 How to deal... 4 With a large index we should construct a sparse index on the primary index. 234Hotel SofitelA-212 321HiltonB-321 389Hilton C-002 396Hilton A-322 112WestinC-034 253Westin B-219 501MarriotB-069 532MarriotC-304 221The RitzA-007 Hotel Sofitel Hilton Westin Marriot The Ritz Hotel Sofitel Marriot

11 Is this looking familiar? 4 Remember B + -trees –B+ trees are said to be of m-order. A number of the designers choosing. –Each leaf has between m and [m-2] children. –All data is stored at the leaf level. –All leaves are at the same depth

12 Example?


Download ppt "Indexing By: Arnold Mesa. Indexing You can think of an index to a file like a catalogue to a library."

Similar presentations


Ads by Google