Searching Indexed fileds.

A forum for discussing DataStage<sup>®</sup> basics. If you're not sure where your question goes, start here.

Moderators: chulett, rschirm, roy

Post Reply
G SHIVARANJANI
Participant
Posts: 137
Joined: Sun Jan 07, 2007 11:17 pm
Location: VISAKHAPATNAM

Searching Indexed fileds.

Post by G SHIVARANJANI »

Hi,

I have a query regarding Indexes on coulmns of a table.


if there are 8 columns in a table say

col1,col2,col3,col4,col5,col6,col7,col8

and out of theses columns col1 , col2 , col3 together are indexed where all the three form a composite key.

Now if we try to search for col1 only or col2 only instead of all three together.

will the search take lesser time...or we need to put a index on col1 individually for the serch to be faster.

Thanks,
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

It would depend on the database server, on the type of index involved, and perhaps on the query optimizer. In general, however, if the two columns are the leading columns on a three-column index, then the index is likely to be used, if they are not the leading columns then the index is not likely to be used (unless the cost of not doing so is huge). Definitely "it depends".
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
Post Reply