If I have a table like this:
my_table
=======================
id date some_data
Does it make any sense to pull the date
out to it's own table? The date
field would use the date
data type. So it would now look like this:
my_table
==========================
id date_id some_data
dates
==========
id date
According to MySQL, date
data type = 3 bytes. The date_id
would need to be a max of MEDIUMINT
(3 bytes) in order to get the same result. A normal INT
or BIGINT
exceeds the storage requirements of a DATE
type.
A downside to a separate table is that the queries would be more complicated because I am joining another table.
Are there any other ramifications that need to be taken into account as to whether or not to split the date
field into it's own table? My gut reaction is that it's not worth doing unless you are dealing with a small set of dates (small enough to use TINYINT
or SMALLINT
).