Archives

The List

« You’ve Got Six Months (if You’re Lucky!) | Main | BINARY :: MySQL Function of the Day »

MySQL Pop Quiz #20

By Carsten | March 27, 2008

Today’s question comes courtesy of Diego Medina.

I’m still looking for new entries. I get quite a few suggestions, but not all of them make it into quiz questions. Do send in your suggestions!

When using a 1-byte character set like Latin-1, a VARCHAR(250) field requires 251 bytes of storage. A VARCHAR(260) field requires 262 bytes of storage. Why?

Show answer


Do you have your own favorite MySQL question? Is there something in MySQL that has you scratching your head? Send your ideas for new pop quiz questions to carsten (at) bitbybit (dot) dk. Send it in, even if you don’t know the answer — that only makes it more interesting.
More Pop Quiz entries: WWW or RSS.

Topics: MySQL, Pop Quiz |

4 Responses to “MySQL Pop Quiz #20”

  1. Roland Bouman Says:
    March 27th, 2008 at 9:58 am

    Strictly speaking, the amount of storage required is dependent upon the storage engine, the table options and the data type. (think Falcon - encoding or packing will result in as many or as little bytes necessary regardless of the declared type; MyISAM COMPRESSED row format; ARCHIVE).

    Maybe internally, at the field level, these ’storage’ requirements still hold although it is then probably more properly called ‘runtime size requirement’ i/o ’storage requirement’

  2. Diego Medina Says:
    March 27th, 2008 at 3:33 pm

    Thanks for the comment Roland.

  3. Carsten Says:
    March 27th, 2008 at 8:05 pm

    Roland: Absolutely correct, and one also has to remember that “runtime” may cover several aspects (and copies) of the data — indexes, table data, disk buffers, network buffers, caches, etc.

  4. Guerrero de Terracota » MySQL Pop Quiz #20 Says:
    March 31st, 2008 at 9:11 am

    [...] ???????????? ? ?????????? Carsten Pedersen. ???????? [...]

Comments