Thread: Keys vs Indexes
View Single Post
Old 02-03-2004, 09:50 AM   #4 (permalink)
sde
Moderator
 
sde's Avatar
 
Join Date: May 2002
Location: us.ca
Posts: 4,489
sde is on a distinguished road
we don't get angry for n00bs here, this is code newbie =)

indexing is sorta like alphabetizing your records by the field you most likely will be searching for. i didn't understand it very well until i started working with db2. i can't use SQL to read a db2 file ( with rpg on an as/400 ), so i have to read it almost like a text file.

for example, i have a contact table keyed by last name. these 3 records would reside in the database in this order:
Code:
sharon dough
joe duran
peter smith
if they were indexed by first name, it would be:
Code:
joe duran
peter smith
sharon dough
your SQL searches would work no matter what, but if you were searching by last name and a file keyed by last name, your results would return much faster.
__________________
Mike
sde is offline   Reply With Quote