Timestamp as int field, query performance

Posted by Kirzilla on Stack Overflow See other posts from Stack Overflow or by Kirzilla
Published on 2010-04-29T15:08:52Z Indexed on 2010/04/29 15:17 UTC
Read the original article Hit count: 279

Filed under:
|

Hello,

I'm storing timestamp as int field. And on large table it takes too long to get rows inserted at date because I'm using mysql function FROM_UNIXTIME.

SELECT * FROM table WHERE FROM_UNIXTIME(timestamp_field, '%Y-%m-%d') = '2010-04-04'

Is there any ways to speed this query? Maybe I should use query for rows using timestamp_field >= x AND timestamp_field < y?

Thank you


I've just tried this query...

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')

but there is no any performance bonuses. :(

© Stack Overflow or respective owner

Related posts about mysql

Related posts about Performance