Skip navigation links

User Comments

Posted by Igor Ivoilov on March 27 2008 7:51am[Delete] [Edit]

If you need to make select from 2 tables the syntax is

SELECT table1.*,table2.* FROM table1 USE INDEX (col2_index), table2 WHERE table1.col1=table2.col1 AND table1.col2=2 AND table1.col3=3;

Posted by David Bennett on May 21 2008 4:21pm[Delete] [Edit]

Due to an object relational layer that doesn't allow the specification of the index hint in the table_references declaration, I was forced into discovering an alternate technique. By specifying an indexes first column as the first where_condition I was able to force the optimizer to use the index that I wanted. In this case the index I wanted to use began with the 'edited' column (a datetime).

select * from appointment where edited < now() and ...

changed the optimizers index selection and greatly improved query performance.

Posted by Ilan Hazan on November 15 2010 7:33pm[Delete] [Edit]

The query analyzer is not perfect. An Optimizer that picks the wrong plan can cause severe performance issues.
However, this does NOT mean that you should always use a Force Index hint.