Search code examples
mysqlenumsdatabase-normalization

MySQL Database normalization


Should I implement a read database normalization (using join tables) or should I use the ENUM type for static or dynamic data?

For example:

I have a table USER with a user_status. Should I create a table a status table or I create a ENUM list with the statuses?

Thanks G


Solution

  • IMHO, the enum extension makes it much easier to embed semantics into a table and also improves efficiency by:

    1. decreasing the number of joins required for a query
    2. reducing the number of open tables in the DBMS

    The only downsides I am aware of is

    1. the ENUM type is not implemented by other DBMS
    2. if you choose to add additional values to the ENUM set at a later date, you are applying a DDL update - which may take a long time with a very large table

    HTH

    C.