MySQL Forums
Forum List  »  Newbie

Primary Key - datetime type
Posted by: Mike Cornelison
Date: June 23, 2005 01:07AM

The purpose of my db is to log reservations. For any given day, there are only 7 times available that can be reserved.

Because only one reservation can be made for any given time, I figured the best way to layout my table would be to set a datetime type as the primary key.

Datetime is an 8 byte data type, however, and I could simplify the entire time part to nothing more than 8, 10, 12, 14, 16, 18, 20.

Should I consider going to a fixed-length, 13 character string using the format of

YYYY-MM-DD ##

or should I stick with the datetime data type?

I think the most important aspect would be to consider that every time a customer clicks a date on the calendar, we'll be searching through the entire database of reservations to see if any reservations have been made for that exact date, is there a possible performance difference that could lead me to one data type over the other?

Options: ReplyQuote


Subject
Written By
Posted
Primary Key - datetime type
June 23, 2005 01:07AM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.