mysql datetime quick structure
how good is the datetime for questions like: Compare sales from Monday and Thusday?
Mysql keeps datetime as a unix-timestamp internally? So finding mondays will be quite expensive.
Has an开发者_如何转开发ybody got experiance how much better mysql performs when an extra attribute "day" is introduced and given an index? Will indies liked this be used at all? It will only have 7 different states...
how good is the datetime for questions like: Compare sales from Monday and Thusday?
DATETIME
is your best choice, as it's mySQL's native format and any date operations are highly optimized for it.
Mysql keeps datetime as a unix-timestamp internally?
Nope. I don't know what mySQL uses to store DATETIMEs internally, but it's not as Unix timestamps:
The DATETIME type is used when you need values that contain both date and time information. MySQL retrieves and displays DATETIME values in 'YYYY-MM-DD HH:MM:SS' format. The supported range is '1000-01-01 00:00:00' to '9999-12-31 23:59:59'.
精彩评论