Linux Ask!

Linux Ask! is a Q & A web site specific for Linux related questions. Questions are collected, answered and audited by experienced Linux users.

Jul 202010

What is the storage overhead in using VARCHAR in MySQL


MySQL allow VARCHAR to have length from a value from 0 to 65,535.

Since MySQL need to store the length of each VARCHAR field, in additional to the actual data itself, it needs 16 bits = 2 bytes for each field. But if the length of VARCHAR during table creation is less than or equal to 255, it only take 1 byte per field.


 Leave a Reply



You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>