I know using UNIX_TIMESTAMP() will cause MySQL to not cache the query, which is reasonable. But, if I use UNIX_TIMESTAMP() to convert a DATETIME-column, will it also miss the cache?
It will still be cached if you pass a value or column as a parameter to UNIX_TIMESTAMP().
It is also worth knowing in case you weren't aware, that any changes to your table result in the cache being cleared. So if the table you are querying changes frequently, you probably aren't having much if any benefit of the query cache.
From the 5.5 manual:
A query cannot be cached if it contains any of the functions shown in the following table.
- UNIX_TIMESTAMP() with no parameters
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With