[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Optimizing date queries
Hey
Does anyone have some optimization tips for this query:
SELECT count(id) FROM tblTabel WHERE fieldName != '' AND
DATE_FORMAT(myDateField,'%Y%m%d') = 20011120;
It does not use the index i have created, so it scans the entire table,
which is a bit to slow.
The problem off course is, that MySQL has to do a calculation on the
myDateField before it can decide if the row matches. Any "workarounds" for
this?
Mvh Emil
--
Emil Rasmussen
http://noget.net
---------------------------------------------------------------------
Before posting, please check:
http://www.mysql.com/manual.php (the manual)
http://lists.mysql.com/ (the list archive)
To request this thread, e-mail <mysql-thread92988@xxxxxxxxxxxxxxx>
To unsubscribe, e-mail <mysql-unsubscribe-treed=ultraviolet.org@xxxxxxxxxxxxxxx>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php
This mailing list archive is a service of Copilot Consulting.