Bug #46537 Some small documentation changes to myisamchk-memory.html page
Submitted: 4 Aug 2009 1:11 Modified: 21 Aug 2009 15:25
Reporter: Roel Van de Paar Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server: Documentation Severity:S3 (Non-critical)
Version: OS:Any
Assigned to: Paul DuBois CPU Architecture:Any

[4 Aug 2009 1:11] Roel Van de Paar
Description:
This page:
http://dev.mysql.com/doc/refman/5.1/en/myisamchk-memory.html

Lists:
'(largest_key + row_pointer_length) × number_of_rows × 2 

You can check the length of the keys and the row_pointer_length with myisamchk -dv tbl_name.'

Can this be clarified? It is not straightforward to match the output of myisamchk -dv with largest_key and row_pointer_length.

James indicated that the row_pointer_length = datafile pointer, so that is easy.

But, calculating the largest key is not:

CREATE TABLE `testtest` (`id1` int(11) DEFAULT NULL, `id2` int(11) DEFAULT NULL, `id3` int(11) DEFAULT NULL, KEY `id1` (`id1`), KEY `id2` (`id2`,`id3`)) ENGINE=MyISAM;

myisamchk -dv output:

table description:
Key Start Len Index   Type                     Rec/key         Root  Blocksize
1   2     4   multip. long NULL                      0         1024       1024
2   6     4   multip. long NULL                      0         2048       1024
    10    4           long NULL                      0

Also, James indicated:
<James> you might also mention the ambiguity between sort_buffer_size in the command and "you need space for a sort buffer". Would be good to change the latter to "you need space on disk for sorting" to remove the possible confusion.
<James> since customer output doesn't have that convenient indent for the second keypart of the second index, which is part of the ambiguity that would be good if clarified.

How to repeat:
N/A

Suggested fix:
Update documentation.
[7 Aug 2009 1:13] Roel Van de Paar
Also see bug #46578
[21 Aug 2009 15:25] Paul DuBois
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.

The information about myisamchk -dvv output format was in the backup chapter. I relocated it as a new subsection of the myisamchk section, just prior to the "myisamchk memory use" subsection:

http://dev.mysql.com/doc/refman/5.1/en/myisamchk-table-info.html

In the memory-use section, I've revised the text in question as follows:

When using --recover or --sort-recover (but not when using --safe-recover), you need space on disk for sorting. This space is allocated in the temporary directory (specified by TMPDIR or --tmpdir=path). The following formula yields the amount of space required:

(largest_key + row_pointer_length) × number_of_rows × 2

You can check the length of the keys and the row_pointer_length with myisamchk -dv tbl_name (see Section 4.6.3.5, “myisamchk Table Information”). The row_pointer_length and number_of_rows values are the Datafile pointer and Data records values in the table description. To determine the largest_key value, check the Key lines in the table description. The Len column indicates the number of bytes for each key part. For a multiple-column index, the key size is the sum of the Len values for all key parts.