Database Systems: Introduction to Databases and Data Warehouses by Nenad Jukic: Susan Vrbsky Svetlozar Nestorov & Susan Vrbsky & Svetlozar Nestorov

Database Systems: Introduction to Databases and Data Warehouses by Nenad Jukic: Susan Vrbsky Svetlozar Nestorov & Susan Vrbsky & Svetlozar Nestorov

Author:Nenad Jukic: Susan Vrbsky,Svetlozar Nestorov & Susan Vrbsky & Svetlozar Nestorov
Language: eng
Format: epub
Publisher: Prospect Press
Published: 2017-11-15T00:00:00+00:00


FIGURE 6.17 An example of a binary search.

FIGURE 6.18 An example of an index.

Let us now observe how an index increases the search speed. In the example illustrated by Figure 6.16, we illustrated the search for the record whose CustName value is Steve. We showed that the linear search required nine steps. In Figure 6.19, we show the binary version of the same search, enabled by the CUSTNAME_INDEX table. Since the CustName column in the index table is sorted, we can apply a binary search when searching for a particular name. In this case, finding the index table record whose CustName is Steve took three steps. Once the index record with the CustName value Steve was located in the CUSTNAME_INDEX table, its pointer value pointing to the corresponding record in the CUSTOMER table is used to complete the search.

Let us now observe another example illustrating the performance improvement enabled by the use of an index. Let us assume that a user wants to find out how many customers named Pam exist in the relation CUSTOMER (note once again that relation CUSTOMER is not sorted by the CustName column).

First observe the case illustrated by Figure 6.20, which depicts how such a query would be executed on the relation CUSTOMER (shown in Figure 6.15), without the use of an index.



Download



Copyright Disclaimer:
This site does not store any files on its server. We only index and link to content provided by other sites. Please contact the content providers to delete copyright contents if any and email us, we'll remove relevant links or contents immediately.