MySQL VARCHAR Data Type Byte Usage



As we know that in MySQL, VARCHAR values are stored as a 1-byte or 2-byte length prefix plus data. This length prefix points out the number of bytes in the value of data. The data value itself will decide that when VARCHAR data type will use 1-byte and when 2-byte prefix length.

  • A column uses 1-byte length if values require no more than 255 bytes.
  • A column uses 2-byte length if values may require more than 255 bytes.
Updated on: 2020-01-28T09:29:04+05:30

142 Views

Kickstart Your Career

Get certified by completing the course

Get Started
Advertisements