MySQL Forums
Forum List  »  Optimizer & Parser

Re: help me, optimize a long running query
Posted by: h ch
Date: December 26, 2011 11:52PM

date_format(date_add(now(), interval -7 day),'%Y-%m-%d')
can not be simplified to
date_add(now(), interval -7 day)

i find the result is different under mysql 5.0.22 and other mysql version(5.0.45,5.0.77)

in mysql 5.0.22

mysql> select pubDate from trade where pubDate=date_add(now(),interval - 1 day) limit 1;
+------------+
| pubDate |
+------------+
| 2011-12-26 |
+------------+
1 row in set (0.00 sec)

in mysql 5.0.45

mysql> select pubDate from trade where pubDate=date_add(now(),interval - 1 day) limit 1;
Empty set (0.08 sec)

mysql> select pubDate from trade where pubDate='2011-12-26' limit 1;
+------------+
| pubDate |
+------------+
| 2011-12-26 |
+------------+
1 row in set (0.27 sec)

Options: ReplyQuote


Subject
Views
Written By
Posted
3014
October 25, 2011 12:00AM
1135
October 27, 2011 12:39AM
Re: help me, optimize a long running query
1515
December 26, 2011 11:52PM


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.