Epoch vs. Date and time in mysql
mysql
Solution
You want the unix epoch. I've done many extremely massive MySQL databases, one of which is a data tracking application that logs millions of records every day for some users.
The reasons `epoch` is better than `datetime`:
- `int` is only 4 bytes versus 8 for `datetime` - better for storage/memory and ultimately indexing/performance. When you're dealing with millions of rows, it really matters
- Most server-side languages need to convert from the string format to an int format anyway, before it can reformat the data
- No dependency on timezones - with `datetime` you need convert strings that are not stored with timezone ident but with the epoch you only need to know the timezone converting to
Problem
I have simple question. Which format of time is better for storing in mysql, epoch or standard date-time (human readable format). I want to know what format will be better later in table which stores millions of rows, regarding speed of select statements.