How Are Indexes Used to Maintain a Logical Record Order?
A logical record order can also be maintained using an index, or inverted list, as they are sometimes called. An index is simply a table that cross-references record addresses with some field value. For ex- ample, Figure H-8(a) shows the ENROLLMENT records stored in no particular order, and Figure H-8(b) shows an index on StudentNumber. In this index, the StudentNumbers are arranged in sequence, with each entry in the list pointing to a corresponding record in the original data.
As you can see, the index is simply a sorted list of StudentNumbers. To process ENROLLMENT sequen- tially on StudentNumber, we simply process the index sequentially, obtaining ENROLLMENT data by reading the records indicated by the pointers. Figure H-8(c) shows another index for ENROLLMENT—one that maintains ClassNumber order.
To use an index, the data to be ordered (here, ENROLLMENT) must reside on an indexed sequential or direct file, although the indexes can reside on any type of file. In practice, almost all DBMS products keep both the data and the indexes on direct files.
How Are Indexes Used to Maintain a Logical Record Order?
A logical record order can also be maintained using an index, or inverted list, as they are sometimes called. An index is simply a table that cross-references record addresses with some field value. For ex- ample, Figure H-8(a) shows the ENROLLMENT records stored in no particular order, and Figure H-8(b) shows an index on StudentNumber. In this index, the StudentNumbers are arranged in sequence, with each entry in the list pointing to a corresponding record in the original data.
As you can see, the index is simply a sorted list of StudentNumbers. To process ENROLLMENT sequen- tially on StudentNumber, we simply process the index sequentially, obtaining ENROLLMENT data by reading the records indicated by the pointers. Figure H-8(c) shows another index for ENROLLMENT—one that maintains ClassNumber order.
To use an index, the data to be ordered (here, ENROLLMENT) must reside on an indexed sequential or direct file, although the indexes can reside on any type of file. In practice, almost all DBMS products keep both the data and the indexes on direct files.
การแปล กรุณารอสักครู่..