MySQL Forums
Forum List  »  Optimizer & Parser

Re: optimizing abs()
Posted by: Toa Sty
Date: October 25, 2006 05:37AM

Hi Michiel,

I'm not sure that MySQL does much in the way of function specific optimisations, so it acts like it doesn't know anything the result of abs(). As a result, it just scans the table calculating abs() and comparing the result to your value.

Your workaround is just what I'd do in this case. In most other cases like this you have to add a pre-computed column which is pretty ugly.

Function indexes (eg http://www.postgresql.org/docs/8.1/interactive/indexes-expressional.html) in MySQL would be about the best thing ever. Don't think they're likely to happen soon though. :-/

Toasty

-----------------------------------------
email: 'toasty'*3 at gmail

Options: ReplyQuote


Subject
Views
Written By
Posted
3269
October 25, 2006 04:31AM
Re: optimizing abs()
2285
October 25, 2006 05:37AM
1993
October 29, 2006 07:31AM


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.