I store the timestamp as an int field. And on a large table, it takes too long to get the rows inserted in the date, because I use the mysql function FROM_UNIXTIME.
SELECT * FROM table WHERE FROM_UNIXTIME(timestamp_field, '%Y-%m-%d') = '2010-04-04'
Is there a way to speed up this request? Maybe I should use a query for strings with timestamp_field >= x AND timestamp_field < y?
thank
EDITED This query works fine, but you have to take care of the index on timestamp_field .
SELECT * FROM table WHERE
timestamp_field >= UNIX_TIMESTAMP('2010-04-14 00:00:00')
AND timestamp_field <= UNIX_TIMESTAMP('2010-04-14 23:59:59')
source
share