Re: Optimizing WHERE computations
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';
Subject
Views
Written By
Posted
2440
May 30, 2005 11:48AM
1659
May 30, 2005 06:52PM
1837
May 31, 2005 04:52AM
1676
May 31, 2005 05:35AM
1708
May 31, 2005 07:08AM
1299
May 31, 2005 07:11AM
1780
May 31, 2005 10:45AM
1969
May 31, 2005 07:19PM
1765
June 01, 2005 08:53AM
1730
June 02, 2005 06:41PM
Re: Optimizing WHERE computations
1817
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.