Comments on: Benchmarks for DATE operations in MySQL http://www.xaprb.com/blog/2006/06/12/benchmarks-for-date-operations-in-mysql/ Stay curious! Fri, 10 May 2013 18:25:19 +0000 hourly 1 http://wordpress.org/?v=3.5.1 By: Xaprb http://www.xaprb.com/blog/2006/06/12/benchmarks-for-date-operations-in-mysql/#comment-15411 Xaprb Tue, 18 Nov 2008 22:12:03 +0000 http://www.xaprb.com/blog/?p=133#comment-15411 OK that’s fine, but to do LEFT() MySQL has first to convert the value from a date to a string — which has all the locale etc overhead too. Seriously, this cannot be anything but a bug.

]]>
By: Rodrigo http://www.xaprb.com/blog/2006/06/12/benchmarks-for-date-operations-in-mysql/#comment-15409 Rodrigo Tue, 18 Nov 2008 20:05:00 +0000 http://www.xaprb.com/blog/?p=133#comment-15409 I agree with that. LEFT() is faster because DATE has to work with locale and l10n related things that LEFT doesn’t. When using LEFT you are directly saying that the Leftomost part of the string is the date, and is the exact format MySQL is expecting it to be.

]]>
By: mysql的datetime時間格式,以left增進查詢效率 http://www.xaprb.com/blog/2006/06/12/benchmarks-for-date-operations-in-mysql/#comment-15381 mysql的datetime時間格式,以left增進查詢效率 Wed, 12 Nov 2008 13:57:33 +0000 http://www.xaprb.com/blog/?p=133#comment-15381 [...] 雖然上一篇說明本人偏好unixtime的格式。 但datetime格式還是很好用的。 最大的優點就是在資料章的結果中,可以迅速看出到底是幾年幾月幾日。 今天看到這一篇文章 Benchmarks for DATE operations in MySQL [...]

]]>
By: Amit Shah http://www.xaprb.com/blog/2006/06/12/benchmarks-for-date-operations-in-mysql/#comment-15342 Amit Shah Wed, 05 Nov 2008 10:11:59 +0000 http://www.xaprb.com/blog/?p=133#comment-15342 Yes Baron,

You are right that LEFT() is a string function thats reason it is faster then DATE().

]]>
By: Sheeri K. Cabral http://www.xaprb.com/blog/2006/06/12/benchmarks-for-date-operations-in-mysql/#comment-15330 Sheeri K. Cabral Sat, 01 Nov 2008 20:17:46 +0000 http://www.xaprb.com/blog/?p=133#comment-15330 Baron,

Got here from your recent post that referenced this one. It may be because LEFT() is just string manipulation, but the DATE() function has to extract the date part — it may have to convert the date to an internal representation to extract the date.

That being said, there should at least be a part of the optimizer that deals with optimizing away something like DATE(col) where col is already in the date format. For instance, SELECT DATE(col) should be optimized to SELECT col when col is in DATE format, so I’d expect that to come back even faster than LEFT().

]]>