Bug #39430 Memory usage of Attributes with NULL Value, Cluster
Submitted: 12 Sep 2008 23:23 Modified: 2 Oct 2008 14:49
Reporter: Gustaf Thorslund Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server: Documentation Severity:S3 (Non-critical)
Version:all OS:Any
Assigned to: Jon Stephens CPU Architecture:Any
Tags: memory usage, ndb, null

[12 Sep 2008 23:23] Gustaf Thorslund
Description:
Reading the manual at:
 http://dev.mysql.com/doc/refman/5.1/en/storage-requirements.html

"The NDBCLUSTER storage engine in MySQL 5.1 supports variable-width
columns. This means that a VARCHAR column in a MySQL Cluster table
requires the same amount of storage as it would using any other
storage engine, with the exception that such values are 4-byte
aligned. Thus, the string 'abcd' stored in a VARCHAR(50) column using
the latin1 character set requires 8 bytes (rather than 6 bytes for the
same column value in a MyISAM table). This represents a change in
behavior from earlier versions of NDBCLUSTER, where a VARCHAR(50)
column would require 52 bytes storage per record regardless of the
length of the string being stored."

But it does not describe how much memory will be used if the value is
set to NULL.

Some testing shows that a NULL Value might take 0 or 1.25 bytes. I
also shows that there is some overhead for having a VARSIZE column in
the table.

It appears there might also be a difference if the attribute have been
touched and reset to NULL again or not touched in the first place.

How to repeat:
See attachment

Suggested fix:
Document how much memory a VARSIZE attribute will need if NULL. Also
clarify if there are any other overhead related to using VARSIZE
attributes.
[12 Sep 2008 23:24] Gustaf Thorslund
Black box testing

Attachment: varsize_test.txt (text/plain), 14.99 KiB.

[2 Oct 2008 14:49] 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 products.