List:General Discussion« Previous MessageNext Message »
From:Mr. Shawn H. Corey Date:July 31 2008 3:38pm
Subject:Re: SET vs. ENUM
View as plain text  
On Thu, 2008-07-31 at 11:24 -0400, Perrin Harkins wrote:
> On Thu, Jul 31, 2008 at 9:46 AM, Jerry Schwartz
> <jschwartz@stripped> wrote:
> > Other than the fact that an ENUM can have many more values than a SET, is
> > there any particular reason to choose one over the other?
> 
> The only use for ENUM is to make your data smaller.  It offers no
> protection against illegal values and can't be updated without copying
> the table.  If you want to constrain values, a better approach is to
> make your tables InnoDB and use a lookup table with a foreign key
> constraint.
> 
> - Perrin
> 

I don't see how that can be; with ENUM the DB has to set aside enough
bytes for the longest identifier.  The only advantage of ENUM is that
the data is in the same table; you don't have to do an extra join.  It
can save you some processing time.


-- 
Just my 0.00000002 million dollars worth,
  Shawn

"Where there's duct tape, there's hope."

"Perl is the duct tape of the Internet."
        Hassan Schroeder, Sun's first webmaster

Thread
SET vs. ENUMJerry Schwartz31 Jul
  • Re: SET vs. ENUMMartijn Tonies31 Jul
    • RE: SET vs. ENUMJerry Schwartz31 Jul
  • Re: SET vs. ENUMMartijn Tonies31 Jul
    • RE: SET vs. ENUMJerry Schwartz31 Jul
      • Re: SET vs. ENUMChris W31 Jul
        • Re: SET vs. ENUMMr. Shawn H. Corey31 Jul
          • Re: SET vs. ENUMChris W31 Jul
  • Re: SET vs. ENUMPerrin Harkins31 Jul
    • Re: SET vs. ENUMMr. Shawn H. Corey31 Jul
      • Re: SET vs. ENUMPerrin Harkins31 Jul
    • RE: SET vs. ENUMJerry Schwartz31 Jul
  • Re: SET vs. ENUMMartijn Tonies1 Aug