If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Database Server Software > MySQL > best datatype

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 12-03-11, 06:46
bono56 bono56 is offline
Registered User
 
Join Date: May 2004
Posts: 133
best datatype

hi
i just wonder what's the most oprimized datatype for storing number between 1-10. is it tinyint or define ENUM?
__________________
Lyrics Database: www.shermani.com
Reply With Quote
  #2 (permalink)  
Old 12-03-11, 07:13
healdem healdem is online now
Jaded Developer
 
Join Date: Nov 2004
Location: out on a limb
Posts: 9,250
tiny int
why?
it allows you to cater for change. ie you may think youonly need 10 now, your users may come upo with ever more creative values. if its an ENUM it requires design chanegs, if its a FK to another table its a data change with minimum impact on development resources.

Also depending on the implementation the ENUM may impact on use elsewhere (this is applicable if you are using Access/JET).

A change in term or description requires changes to the table with an ENUM
__________________
I'd rather be riding my Versys or my Tiger 800 let alone the Norton
Reply With Quote
  #3 (permalink)  
Old 12-08-11, 14:50
robcarrol71 robcarrol71 is offline
Registered User
 
Join Date: Dec 2011
Posts: 7
I agree, go with tinyint for the reasons provided.

The storage required for a tinyint is 1byte, and the storage required for an enum with 10 values is 1byte as well. So, no difference in row size between the two.

MySQL :: MySQL 5.0 Reference Manual :: 10.5 Data Type Storage Requirements
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On