12

How do databases (mySQL if a particular example is important) determine the size of the column needed to store an ENUM?

Is it something simple like a single byte for less than 256 enum options, etc.?

1 Answers1

27

MySQL Manual says "1 or 2 bytes, depending on the number of enumeration values". If the ENUM has less than 256 possible values, it uses 1 byte, otherwise 2.

See: 10.5. Data Type Storage Requirements

Chad Birch
  • 73,098
  • 23
  • 151
  • 149