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
2234
May 30, 2005 11:48AM
1551
May 30, 2005 06:52PM
1719
May 31, 2005 04:52AM
1570
May 31, 2005 05:35AM
1586
May 31, 2005 07:08AM
1184
May 31, 2005 07:11AM
1674
May 31, 2005 10:45AM
1851
May 31, 2005 07:19PM
1669
June 01, 2005 08:53AM
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.