content_image/703511.jpg
/ sample_size 

In the preceding formula, key_size  is the size of the ordered index key in bytes, key_attributes  is the number ot attributes in the ordered index key, and rows  is the number of rows in the base table. 

Assume that table t1  has 1 million rows and an ordered index named ix1  on two four-byte integers. Assume in addition that IndexStatSaveSize  and IndexStatSaveScale  are set to their default values (32K and 100, respectively). Using the previous 2 formulas, we can calculate as follows: 

sample_size = 8 + ((1 + 2) * 4) = 20 bytes sample_rows = 32K * ((0.01 * 100 * log$_{2}$(1000000*20)) + 1) / 20 = 32768 * ( (1 * ~16.811) +1) / 20 = 32768 * ~17.811 / 20 = ~29182 rows 

The expected index memory usage is thus 2 * 18 * 29182 = ~1050550 bytes. 

In NDB 8.0, the minimum and default vaue for this parameter is 0 (zero). 

• StringMemory 

<img src='content_image/703511.jpg'>

This parameter determines how much memory is allocated for strings such as table names, and is specified in an [ndbd]  or [ndbd default]  section of the config.ini  file. A value between 0  and 100  inclusive is interpreted as a percent of the maximum default value, which is calculated based on a number of factors including the number of tables, maximum table name size, maximum size of .FRM files, MaxNoOfTriggers , maximum column name size, and maximum default column value. 

A value greater than 100  is interpreted as a number of bytes. 

The default value is 25—that is, 25 percent of the default maximum. 

Under most circumstances, the default value should be sufficient, but when you have a great many NDB tables (1000 or more), it is possible to get Error 773 Out of string memory, please modify StringMemory config parameter: Permanent error: Schema error , in which case you should increase this value. 25  (25 percent) is not excessive, and should prevent this error from recurring in all but the most extreme conditions. 

The following example illustrates how memory is used for a table. Consider this table definition: 

CREATE TABLE example ( a INT NOT NULL, b INT NOT NULL, c INT NOT NULL, PRIMARY KEY(a), UNIQUE(b) ) ENGINE=NDBCLUSTER; 

For each record, there are 12 bytes of data plus 12 bytes overhead. Having no nullable columns saves 4 bytes of overhead. In addition, we have two ordered indexes on columns a  and b  consuming roughly 10 

