MySQL Integer vs DateTime index
Posted
by
David Kuridža
on Stack Overflow
See other posts from Stack Overflow
or by David Kuridža
Published on 2011-01-04T13:40:16Z
Indexed on
2011/01/04
15:54 UTC
Read the original article
Hit count: 146
Let me start by saying I have looked at many similar questions asked, but all of them relate to Timestamp
and DateTime
field type without indexing. At least that is my understanding.
As we all know, there are certain advantages when it comes to DateTime. Putting them aside for a minute, and assuming table's engine is InnoDB
with 10+ million records
, which query would perform faster when criteria is based on:
- DateTime with index
- int with index
In other words, it is better to store date and time as DateTime
or UNIX timestamp in int
? Keep in mind there is no need for any built-in MySQL functions to be used.
© Stack Overflow or respective owner