Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Db2 Indexing

Status
Not open for further replies.

etan1999

Programmer
Jun 17, 2003
4
CA
Hi all.

My application is having timeout problem due to the length of time to execute a DB2 Select statement. It is going against a table, averaging about 18 million records with 22 columns. This sql statement has one WHERE condition, a date field which is NOT part of any index. I have asked our DBA if building an index based on this date field would improve the performance and he said no because of its DATE data type. My questions are :
1) Is an index on a DATE column NOT as efficient as an index based on a CHAR or NUMERIC field ?
2) Can you recommend another solution ?

Thank you so much.
 
I would be pragmatic and do a little testing with an index on the date field. An explain plan will tell you quickly whether the addition of the index will increase performance.
Are there any other indices active, is there a primary key (must be). Can you extend the condition with a field that is part of the primary key?
If adding the index is not benificial, you drop the index altogether ..........
I think indices on integers are the most efficient performance-wise. Look into 'clustered indices' as well

T. Blom
Information analyst
tbl@shimano-eu.com
 
T. Blom,
Thanks for the immediate response. Yes, there are 3 indices defined for this table but none include this date field. We are working with our clients to see if they would be flexible enough to do a search based on other columns too.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top