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!

Choosing the right index in a SELECT statement 1

Status
Not open for further replies.

GEBOF

Programmer
Aug 23, 2001
3
BE
Hi,

A table has an index on two fields (not the unique index).
When selecting data using the fields of the index the system performs a sequential scan.

Can I tell informix to use the index I want it to Use ?


Thanks
 

The select statemnt which use should have the same key sequence, then the informix will automaticaly refer to the related index. For E.g:

If you have two indexes one on emp_code field and the other one on grade_code.

The select statment

select * from employee_mast
where emp_code = "1057";

will refer the emp_code index. If you want to refer to all the rows of a select statemnt, you can specifiy some query which selects all the rows like this
where emp_code matches "*";


G.R.P.
 
Thanks for helping out.

I've Updateted the statistics of the table and now the select statement chooses the right index.

Gebof
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top