Bug #84440 bytes required for CHAR
Submitted: 7 Jan 2017 18:28 Modified: 7 May 2018 19:43
Reporter: Rick James Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server: Documentation Severity:S3 (Non-critical)
Version:recent OS:Any
Assigned to: CPU Architecture:Any
Tags: char, character set, charset

[7 Jan 2017 18:28] Rick James
Description:
https://dev.mysql.com/doc/refman/5.7/en/charset-unicode-utf8mb4.html says that CHAR(10) CHARACTER SET utf8mb4 reserves 40 bytes.  But, in some (all?) record formats with InnoDB, the column may occupy only 10 bytes.

Also, won't this take zero bytes if the column is NULL?  Plus perhaps a single bit, somewhere else?

How to repeat:
N/A

Suggested fix:
Reword the end of the page given to make the following clear:

* Under what conditions with CHAR(10) take only 10 bytes for non-wide characters.
* How NULLs are handled -- leaving no space for the string.
* Whether there is a 1 or 2 byte length column (in InnoDB) in front of all columns.
* When (contrary to EXPLAIN, which always says 2) a VARCHAR needs only 1 byte of length.

Then check other references for consistency.

I suspect some of the text is legacy from the days when MyISAM was the only engine.
[8 Jan 2017 5:35] MySQL Verification Team
Hello Rick James,

Thank you for the report and feedback!

Thanks,
Umesh
[7 May 2018 19:43] Daniel Price
Posted by developer:
 
The tip was removed as it no longer generally applies. A reference was added to the string type storage requirements section which provides information about data types storage and multibyte characters.
https://dev.mysql.com/doc/refman/5.7/en/storage-requirements.html#data-types-storage-reqs-...

This section also addresses VARCHAR storage requirements.

Thank you for the bug report.