Spec-Zone .ru
спецификации, руководства, описания, API

4.6.3.5. Obtaining Table Information with myisamchk

To obtain a description of a MyISAM table or statistics about it, use the commands shown here. The output from these commands is explained later in this section.

The tbl_name argument can be either the name of a MyISAM table or the name of its index file, as described in Section 4.6.3, "myisamchk — MyISAM Table-Maintenance Utility". Multiple tbl_name arguments can be given.

Suppose that a table named person has the following structure. (The MAX_ROWS table option is included so that in the example output from myisamchk shown later, some values are smaller and fit the output format more easily.)

CREATE TABLE person(  id         INT NOT NULL AUTO_INCREMENT,  last_name  VARCHAR(20) NOT NULL,  first_name VARCHAR(20) NOT NULL,  birth      DATE,  death      DATE,  PRIMARY KEY (id),  INDEX (last_name, first_name),  INDEX (birth)) MAX_ROWS = 1000000;

Suppose also that the table has these data and index file sizes:

-rw-rw----  1 mysql  mysql  9347072 Aug 19 11:47 person.MYD-rw-rw----  1 mysql  mysql  6066176 Aug 19 11:47 person.MYI

Example of myisamchk -dvv output:

MyISAM file:         personRecord format:       PackedCharacter set:       latin1_swedish_ci (8)File-version:        1Creation time:       2009-08-19 16:47:41Recover time:        2009-08-19 16:47:56Status:              checked,analyzed,optimized keysAuto increment key:              1  Last value:                306688Data records:               306688  Deleted blocks:                 0Datafile parts:             306688  Deleted data:                   0Datafile pointer (bytes):        4  Keyfile pointer (bytes):        3Datafile length:           9347072  Keyfile length:           6066176Max datafile length:    4294967294  Max keyfile length:   17179868159Recordlength:                   54table description:Key Start Len Index   Type                 Rec/key         Root  Blocksize1   2     4   unique  long                       1        99328       10242   6     20  multip. varchar prefix           512      3563520       1024    27    20          varchar                  5123   48    3   multip. uint24 NULL           306688      6065152       1024Field Start Length Nullpos Nullbit Type1     1     12     2     4                      no zeros3     6     21                     varchar4     27    21                     varchar5     48    3      1       1       no zeros6     51    3      1       2       no zeros

Explanations for the types of information myisamchk produces are given here. "Keyfile" refers to the index file. "Record" and "row" are synonymous, as are "field" and "column."

The initial part of the table description contains these values:

The table description part of the output includes a list of all keys in the table. For each key, myisamchk displays some low-level information:

The last part of the output provides information about each column:

The Huff tree and Bits fields are displayed if the table has been compressed with myisampack. See Section 4.6.5, "myisampack — Generate Compressed, Read-Only MyISAM Tables", for an example of this information.

Example of myisamchk -eiv output:

Checking MyISAM file: personData records:  306688   Deleted blocks:       0- check file-size- check record delete-chainNo recordlinks- check key delete-chainblock_size 1024:- check index reference- check data record references index: 1Key:  1:  Keyblocks used:  98%  Packed:    0%  Max levels:  3- check data record references index: 2Key:  2:  Keyblocks used:  99%  Packed:   97%  Max levels:  3- check data record references index: 3Key:  3:  Keyblocks used:  98%  Packed:  -14%  Max levels:  3Total:    Keyblocks used:  98%  Packed:   89%- check records and index references*** LOTS OF ROW NUMBERS DELETED ***Records:            306688  M.recordlength:       25  Packed:            83%Recordspace used:       97% Empty space:           2% Blocks/Record:   1.00Record blocks:      306688  Delete blocks:         0Record data:       7934464  Deleted data:          0Lost space:         256512  Linkdata:        1156096User time 43.08, System time 1.68Maximum resident set size 0, Integral resident set size 0Non-physical pagefaults 0, Physical pagefaults 0, Swaps 0Blocks in 0 out 7, Messages in 0 out 0, Signals 0Voluntary context switches 0, Involuntary context switches 0Maximum memory usage: 1046926 bytes (1023k)

myisamchk -eiv output includes the following information: