MySQL Forums
Forum List  »  InnoDB

Function and indexes
Posted by: Lucio Menci
Date: November 13, 2014 10:52AM

Hi,

I'd like to know if there are functions which, when used in WHERE conditions on indexed columns, these conditions continue to use indexes.

An example:
Select * From MyTable Where MyColumn Like 'aaa%'
If MyColumn is indexed, the select statement uses that index.
Select * From MyTable Where Left(MyColumn, 3) = 'aaa'
is apparently the same select. Is it still using the same index?

Or
Select * From MyTable Where MyValue Between ?Val - 0.3 And ?Val + 0.3
Uses the index.
Select * From MyTable Where Abs(MyValue - ?Val) < 0.3
That I have to use if I want to be excluded when the distance between MyValue and ?Val is exactly 0.3. Still use the index?

Or (better) Which functions respect the use of indices and which are not?

Thank you

Options: ReplyQuote


Subject
Views
Written By
Posted
Function and indexes
2086
November 13, 2014 10:52AM
990
November 14, 2014 12:57PM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.