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 Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Performance - Informix Gurus - Please help 1

Status
Not open for further replies.

shhankar

Programmer
Apr 15, 2003
14
US
I have a table called "performance" with more than 108 million rows.

The table has an index on the following fields:
cl_id
his_date
his_class
his_code
his_type

I am writing a query that uses only
his_class
his_code
his_type

Because of this the query is doing a SEQUENTIAL SCAN instead of using the available INDEX. Hence it is taking lot of time to return the results.

My current informix doesn't support OPTIMIZER DIRECTIVES.

So please help me so that I can use the available index.
 
if you have only one index consisting of the listed fields, this result is expected.

the optimizer uses a compound-index (index consisting of more than one field) starting from left to right.

so in your case : if you do not include cl_id and his_date in your query, the optimizer cannot make use of your index.

so either include these fields in your query or create another index consisting of his_class, his_code and his_type.

Concerning performance it is helpful to start with most selective field in your index, i.e. if cl_id can only have two different values, this would be a good choice for the first index-field.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top