Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

MySQL SELECT in a large table faster with indexed INT or indexed TIMESTAMP

Tags:

php

mysql

I want to create a MyISAM log table with Unix timestamp values. I will have various SELECT statements every once in while using a "from" date to "to" date and the table will grow quite large.

I don't know which would be the fastest between an Indexed INT or Indexed TIMESTAMP (they have the same storage space I believe).

I checked on Stackoverflow already but the answers are somewhat vague, from new members or they say one or the other.

like image 626
user2608458 Avatar asked Feb 16 '23 20:02

user2608458


1 Answers

It shouldn't make a difference. Timestamps are represented internally as integers, so comparing and indexing them will be essentially the same.

like image 193
Barmar Avatar answered Feb 18 '23 12:02

Barmar