Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8407779
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T23:27:39+00:00 2026-06-09T23:27:39+00:00

I did a test to make sure I know how ENUM works and how

  • 0

I did a test to make sure I know how ENUM works and how it handles storage space… and got different results than expected.

One table with one field of type VARCHAR(100) populated with 1,000,000 rows. Each row has a value randomly selected from 1 of 6 strings, length of 100.

Then, conversion to ENUM, then back to VARCHAR(100). Here are the results (Data size).

1. Rows 1,000,000 = 99.2 MiB, VARCHAR(100)

2. Rows 1,000,000 = 6,835.9 KiB, Enum
(‘blah100Characters1′,’blah100Characters2′,…,’blah100Characters6’)

3. Rows 1,000,000 99.2 MiB, VARCHAR(100)

The VARCHAR(100) type reported as expected and matches the MySQL specification in the manual of (“L + 1 bytes, 0 <= L <= 255”)
1,000,000 x 100 = 100,000,000 = 99.2 MiB

—Edit: Well, plus that one extra byte, but that’s irrelevant to this discussion :o)

however, according to the MySQL specification of ENUM (“1 or 2 bytes, depending on the number of enumeration values (65,535 values maximum)”), with 6 possible combinations I’d expect there to be a data requirement of 1 byte per row.
1,000,000 x 1 = 1,000,000 = 976.5 KiB

Can anyone explain to me why the converted table requires 6,835.9 KiB, which is, oddly enough, almost exactly 7 times more than expected?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-09T23:27:41+00:00Added an answer on June 9, 2026 at 11:27 pm

    It adds up to 7 bytes (I get the same results); some of the space is padding and some is for a delete flag.

    To prove that there is padding, add additional enums (or tiny integers). The size of the table does not change.

    To prove that there is a delete flag, delete a row in the middle. The size of the table does not change.

    According to this page, it has to do with myisam_data_pointer_size having a default value of 6 bytes (plus 1 byte for delete).

    And he seems to be correct, as if I do this:

    alter table foo MAX_ROWS=10;
    

    the size of the table decreases.

    Furthermore, from this “bug” report, it sounds like a deleted record is stored as a pointer to the next record. If so, that would mean the minimum space for any row would be the pointer size (6 bytes, by default) plus a delete byte. This is because if a record is deleted, the delete byte is set, and then the other 6 bytes are used to point to the next record.

    If you want more info, I’d read up on the “delete link chain” of MyISAM tables (when using fixed record counts).

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Im curious how you guys visual make distinction between the different Rails modes development/test
I did a test in chrome and firefox, chrome with no extension, firefox with
f'I have the following: A---B---C-----D-- branch dev \--C'-E-/ branch test I did it bad:
In an Oracle 10 database, I did a small test: SELECT REGEXP_REPLACE('İF', '[Iİ]F', 'DONE',
I was curious that what does setTimeout return. So I did a quick test:
I want to pass tests which get the following: This test did not perform
Until recently, our app did not specify a doctype. Then, to make the app
I recently started creating apps for android and wanted to test layouts for different
I am testing out a property system and I want to make sure that
I may have found a Subversion bug, and I would like to make sure

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.