Bug #13162 Does not talk about alignment in ndb storage requirements
Submitted: 14 Sep 2005 5:55 Modified: 12 Apr 2006 11:31
Reporter: Stewart Smith Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server: Documentation Severity:S3 (Non-critical)
Version: OS:
Assigned to: Jon Stephens CPU Architecture:Any

[14 Sep 2005 5:55] Stewart Smith
Description:
All fields in NDB are aligned/padded to 32bits.

e.g. a 1byte field really uses 4bytes.

and a CHAR(10) will use 12 bytes.

(see ndb_size.pl for how I compute it)

How to repeat:
know the insides of NDB :)

Suggested fix:
update the documentation.
[12 Apr 2006 6:25] Stewart Smith
All fields in NDB tables are aligned to 4 byte boundaries.

This means that the space used for a column is always divisible by 4.

If the space used would be 2, 4 bytes will be used (as we round up to the nearest factor).
If the space used would be 15, 16 bytes are used
1 -> 4
2 -> 4
3 -> 4
4 -> 4

etc.
[12 Apr 2006 11:31] Jon Stephens
Thank you for your bug report. This issue has been addressed in the
documentation. The updated documentation will appear on our website
shortly, and will be included in the next release of the relevant
product(s).

Additional info:

Updated Storage Requirements section in Manual 4.1/5.0/5.1 Data Types Chapter as indicated.

(Thanks, Stewart!)