View previous topic :: View next topic
|
Author |
Message |
shyam k dhanraj
New User
Joined: 18 Jun 2008 Posts: 27 Location: bangalore
|
|
|
|
I know that secondary index is used when there is a requirement to select database records in a sequence other than that defined by the root key. What is the biggest advantage of doing this in terms of performance. Can any one please explain this with a small example? |
|
Back to top |
|
|
Anuj Dhawan
Superior Member
Joined: 22 Apr 2006 Posts: 6250 Location: Mumbai, India
|
|
|
|
Hi,
In General, A secondary index provides additonal direct access to rows.
For example an "Merchant " table might have a primary key of "Merchant Number". Each merchant also has their current department code (Dept_code) in their Merchant table entry. If Dept_code was a secondary index, a query could directly retrieve all of the people in a specific department without traversing the entire table. |
|
Back to top |
|
|
Anuj Dhawan
Superior Member
Joined: 22 Apr 2006 Posts: 6250 Location: Mumbai, India
|
|
Back to top |
|
|
shyam k dhanraj
New User
Joined: 18 Jun 2008 Posts: 27 Location: bangalore
|
|
|
|
I have all the redbooks that I want. I have recently also built a secondary index and I am making use of it. I am using a HIDAM database. Secondary index in general gives me an option of direct access to rows. In a HIDAM database, how does a secondary index help me in terms of number of segment occurences accessed if I dont use secondary index and I dont use secondary index
Note: Deleted the duplicate post..Anuj |
|
Back to top |
|
|
enrico-sorichetti
Superior Member
Joined: 14 Mar 2007 Posts: 10872 Location: italy
|
|
|
|
as a general concept secondary/alternate indexing is just that
a different access path to &database &records
there is no advantage / disadvantage considerations
just access path considerations
if You have a &database with two fields
field1,field2
field1 primary key ( hence ordered )
field2 .......
if You want to access a &database &record where field2 has a specific value
You have two chances
read sequentially the &database until Your search is satisfied
.... use a secondary/alternate index |
|
Back to top |
|
|
|