Answer the question
In order to leave comments, you need to log in
Choice of time storage format?
Greetings. At me an eternal problem of a choice of a format of storage of time.
When is it better to use DATETIME when just INT for timestamp?
The date / time of birth is DATETIME exactly, but the last update of the record in the database? What criteria should be followed?
Thanks
Answer the question
In order to leave comments, you need to log in
Everything is very simple - if it is a date and / or time - use the datetime format, in all other cases the types correspond to the stored data. Int for timestamp is generally obscene in its purest form.
Do you have a date of birth? You can use DATE here, but I would not be stingy and set DATETIME for reasons of uniformity in working with date and time.
it is more convenient and faster to work with a normal date than with a timestamp number.
In terms of speed on my tests of datetime with an index versus int with an index, the first option won. Although it was obvious that the second should be faster, it turned out that it was not. (In the Mysql database, of course, I won’t speak for others).
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question