number or word for ENUM field, MySQL

Post June 20th, 2008, 9:50 am

Hi everyone,

i just would like to know what better for performance
number or word variants for enum field in MySQL.

i mean
Code: [ Download ] [ Select ]
 
enum('active','inactive','deleted','draft')
  1.  
  2. enum('active','inactive','deleted','draft')

or
Code: [ Download ] [ Select ]
 
enum('0','1','2','3')
  1.  
  2. enum('0','1','2','3')
  • Anonymous
  • Bot
  • No Avatar
  • Joined: 25 Feb 2008
  • Posts: ?
  • Loc: Ozzuland
  • Status: Online

Post June 20th, 2008, 9:50 am

  • joebert
  • Weathered
  • Genius
  • User avatar
  • Joined: Feb 10, 2004
  • Posts: 11879
  • Loc: Clearwater, FL
  • Status: Offline

Post June 20th, 2008, 10:17 am

What ever one makes more sense for the situation.
I really doubt any difference in performance will outweigh the readability of any code working with the values. :D
Why yes, yes I am.

Post June 20th, 2008, 10:55 am

in some cases for mysql easier to work with integer then with string
  • spork
  • HB
  • Silver Member
  • User avatar
  • Joined: Sep 22, 2003
  • Posts: 5483
  • Loc: Rochester, NY
  • Status: Offline

Post June 20th, 2008, 11:10 am

Enums are essentially sets of integer constants that begin at 0 unless otherwise specified. The whole point of using enums is to give the constants meaningful names to use elsewhere. Giving them names that are simply textual representations of the numbers they represent kinda defeats the purpose. ;)
How to Maintain Simple, Static Pages in a CakePHP Application
EEEEEEEEE! It's here!!
  • joebert
  • Weathered
  • Genius
  • User avatar
  • Joined: Feb 10, 2004
  • Posts: 11879
  • Loc: Clearwater, FL
  • Status: Offline

Post June 20th, 2008, 1:34 pm

Here all this time I've been considering enums the switch statements of data types. :scratchhead:
Why yes, yes I am.

Post June 21st, 2008, 1:49 am

As i understood it easier to use text for father development =)
thanks a lot =)

Post Information

  • Total Posts in this topic: 6 posts
  • Users browsing this forum: No registered users and 224 guests
  • You cannot post new topics in this forum
  • You cannot reply to topics in this forum
  • You cannot edit your posts in this forum
  • You cannot delete your posts in this forum
  • You cannot post attachments in this forum
 
 

© Unmelted Enterprises 1998-2009. Driven by phpBB © 2001-2009 phpBB Group.