Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups Profile Log in to check your private messages Log in
 

 

INDEX SEARCH IS FAST?

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL
View previous topic :: :: View next topic  
Author Message
sararaju

New User


Joined: 04 May 2005
Posts: 25

PostPosted: Thu May 26, 2005 9:41 am    Post subject: INDEX SEARCH IS FAST?
Reply with quote

WHY INDEX READING IS FASTER THAN SEQUENTIAL READ AND HOW?

FOR EXAMPLE WE HAVE 30 RECORDS. IF I WANT TO READ THE 30TH RECORD I SUPPOSE TO BYPASS UPTO 29TH RECORD. THIS IS SEQUENTIAL READ.WHERE IN INDEX WE HAVE READ THE KEY VALUE UPTO 29TH RECORD. THEN WHY PEOPLE ARE SAYING INDEX READING IS FASTER THEN SEQUNTIAL? PLS CLARIFY IT.
Back to top
View user's profile Send private message

SteveConway

New User


Joined: 26 May 2005
Posts: 28
Location: Northern VA, USA

PostPosted: Fri May 27, 2005 8:28 pm    Post subject: Re: INDEX SEARCH IS FAST?
Reply with quote

Hi, Sararaju. I will assume you are speaking of something like a VSAM KSDS.
An index record is small, generally containing pointers to a particular data area within the file, noting the highest and lowest key values of the records within that area.
Let's assume, for example's sake, that we have a file with 1,000 records. Let's also assume that this particular file is structured in a way that each index record's high and low key values encompass about 100 records.
If the record we want to get to is #810 (relative to the beginning of the file) how many records do we have to read to get there?
If we read sequentially, we have to read 809 records first, then our record.
If we read the indexes, we read 9 index records (when the high value pointer is > our desired record, we can stop reading index records), go to the data area that has our record, and read 8 records, then ours. Total 17 records read to get to ours.
The bigger the file, the bigger the resource savings.
Obviously, this is a simplified, non-specific response, just to illustrate index vs. sequential.
In a (book) library, you don't read each book's title starting at bookshelf #1 until you find the one you want. You use the classification system for books to get you to the correct bookshelf (here it's the Dewey Decimal System), then home in on your book.
Examples are endless...


Cheers,,,Steve
Back to top
View user's profile Send private message
SteveConway

New User


Joined: 26 May 2005
Posts: 28
Location: Northern VA, USA

PostPosted: Fri May 27, 2005 8:36 pm    Post subject: Re: INDEX SEARCH IS FAST?
Reply with quote

In my previous example, I should have stated some assumptions.
If all your records are the same size, and your keys are distributed evenly, and there is no (or no variable) free space in the data set, you may be able to go directly to the desired record in a more efficient fashion.
Real world data has a tendency to be more messy, with uneven distribution of keys and variable record lengths, which would require you to read each record, compare its key, get the record's length so you can bump to the next record, and so on. Add in free space of possibly varying amounts in each data CI and CA (in a KSDS), and the use of the index becomes more obviously useful.


Cheers,,,Steve
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts setting new limit Key values for inde... srilata83 DB2 1 Fri Feb 10, 2017 9:24 pm
No new posts Order BY AND Index Nileshkul DB2 2 Sat Dec 31, 2016 6:33 pm
No new posts Several errors during building altern... Andi1982 JCL & VSAM 11 Wed Jul 06, 2016 7:39 pm
No new posts Drop building Alternate Index for a p... bhavin.mehta JCL & VSAM 6 Mon Jul 04, 2016 3:47 pm
No new posts Search a Load Module sreekanth1984 TSO/ISPF 8 Tue Jun 07, 2016 8:45 pm


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us