Does it make sense to ever index a DATETIME column? We do a lot of reporting on a large (~10MM records) table where we only need to look at a particular day or two. My selects currently look like:
WHERE entered >= 20040124000000 AND entered <= 20040124235959
An index should help here. So, yes, there is a reason to index a DATETIME column.
Is there such a thing as an index on the first 8 characters of a DATETIME column?
No. Indexes on partial column values are available only for string types.
And if so, how do I reconstruct the WHERE to use it? Would this work:
WHERE SUBSTRING(entered, 1, 8) = 20040124
? I couldn't find any relevant info in the purple book.
I think what you're looking for is pp 271-272. :-)
-- Paul DuBois, MySQL Documentation Team Madison, Wisconsin, USA MySQL AB, www.mysql.com
MySQL Users Conference: April 14-16, 2004 http://www.mysql.com/uc2004/
-- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe: http://lists.mysql.com/[EMAIL PROTECTED]