Card catalogs in libraries works in a similar manner

Info icon This preview shows pages 37–39. Sign up to view the full content.

View Full Document Right Arrow Icon
we are looking for. Card catalogs in libraries works in a similar manner. To find a book by a particular author, we would search in the author catalog, and a card in the catalog tells us where to find the book. To assist us in searching the catalog, the library would keep the cards in alphabetic order by authors, with one card for each author of each book. Database system indices play the same role as book indices or card catalogs in libraries. For example, to retrieve an account record given the account number, the database system would look up an index to find on which disk block the corresponding record resides, and then fetch the disk block, to get the account record. Keeping a sorted list of account numbers would not work well on very large databases with millions of accounts, since the index would itself be very big. So, more sophisticated indexing techniques may be used. Types of Indices There are two basic kinds of indices. 1. Ordered indices: indices are based on a sorted ordering of the values. 2. Hash indices: indices are based on the values being distributed uniformly across a range of buckets. The bucket to which a value is assigned is determined by a function, called a hash function . Index Technique Choosing Factors There are several techniques for both ordered indexing and hashing. No one technique is the best. Each technique is best suited to particular database applications. Each technique must be evaluated on the basis of these factors: 1. Access types – Finding records with a specified value or a range of values . 2. Access time – Time to find a particular data item or a set of items . 3. Insertion time – Time to find the correct place to insert the item + time to update the index. 4. Deletion time – Time to find the item to be deleted + time to update the index. 5. Space overhead – The additional space occupied by an index structure. head2right We may have more than one index or hash function for a file. (The library may have card catalogues by author, subject or title) head2right An attribute or set of attributes used to look up records in a file is called the search key (This definition of key differs from that used in super key, candidate key or primary key).
Image of page 37

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full Document Right Arrow Icon
34 Ordered Indices An ordered index stores the values of the search keys in sorted order and associates with each search key the records that contain it. Primary / Clustering Index If the file containing the records is sequentially ordered, a primary index is an index whose search key also defines the sequential order of the file. The search key of a primary index is usually the primary key, but it is not necessarily so. Secondary / Non-Clustering Index Indices whose search key specifies an order different from the sequential order of the file are called secondary indices .
Image of page 38
Image of page 39
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}

What students are saying

  • Left Quote Icon

    As a current student on this bumpy collegiate pathway, I stumbled upon Course Hero, where I can find study resources for nearly all my courses, get online help from tutors 24/7, and even share my old projects, papers, and lecture notes with other students.

    Student Picture

    Kiran Temple University Fox School of Business ‘17, Course Hero Intern

  • Left Quote Icon

    I cannot even describe how much Course Hero helped me this summer. It’s truly become something I can always rely on and help me. In the end, I was not only able to survive summer classes, but I was able to thrive thanks to Course Hero.

    Student Picture

    Dana University of Pennsylvania ‘17, Course Hero Intern

  • Left Quote Icon

    The ability to access any university’s resources through Course Hero proved invaluable in my case. I was behind on Tulane coursework and actually used UCLA’s materials to help me move forward and get everything together on time.

    Student Picture

    Jill Tulane University ‘16, Course Hero Intern