MySQL Forums
Forum List  »  Performance

Re: Optimizing WHERE computations
Posted by: Benoit St-Jean
Date: June 02, 2005 09:20PM

Craig Matthews wrote:
> Hi,
>
> I know MySQL does not optimize computations in the
> WHERE clauses, e.g.,
>
> SELECT * FROM news
> WHERE time > SUBDATE(NOW(), INTERVAL 1 DAY);
>
> In the above query, what can I do to optimize the
> response time?
>
> Thanks!

If you executing this statement from an application (as opposed to a SQL script), you could calculate he right expression an issue a comparison against a litteral. e.g.

1) Calculate the equivalent of "SUBDATE(NOW(), INTERVAL 1 DAY);"

2)
SELECT *
FROM news
WHERE time > '2005-06-01';

Options: ReplyQuote


Subject
Views
Written By
Posted
2234
May 30, 2005 11:48AM
1620
June 02, 2005 06:41PM
Re: Optimizing WHERE computations
1690
June 02, 2005 09:20PM


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.