1) If the timestamp values ββare unique, you can make it the primary key. If not, create an index in the timestamp column anyway, since you often use it in the "where".
2) using the BETWEEN clause looks more natural. I suggest you use the TREE index (default index type) rather than HASH.
3) when the index column is indexed, you do not need the order of calls - it is already sorted. (of course, if your TREE index is not HASH).
4) integer unix_timestamp is better than datetime both in terms of memory usage and performance. Comparing dates is more complicated than comparing integers.
A data search on an indexed field accepts an O (log (rows)) tree search. Comparing integers is O (1), and comparing dates is O (date_string_length). Thus, the difference (the number of tree searches) * (component_difference) = O (date_string_length) / O (1)) * O (log (rows)) = O (date_string_length) * O (log (rows))
source share