Documentation Home
MySQL 5.6 Reference Manual
Related Documentation Download this Manual
PDF (US Ltr) - 30.9Mb
PDF (A4) - 31.0Mb
PDF (RPM) - 30.2Mb
EPUB - 7.7Mb
HTML Download (TGZ) - 7.5Mb
HTML Download (Zip) - 7.5Mb
HTML Download (RPM) - 6.5Mb
Eclipse Doc Plugin (TGZ) - 8.2Mb
Eclipse Doc Plugin (Zip) - 10.1Mb
Man Pages (TGZ) - 181.3Kb
Man Pages (Zip) - 292.4Kb
Info (Gzip) - 2.9Mb
Info (Zip) - 2.9Mb
Excerpts from this Manual

MySQL 5.6 Reference Manual  /  ...  /  ndb_index_stat — NDB Index Statistics Utility

18.4.14 ndb_index_stat — NDB Index Statistics Utility

ndb_index_stat provides per-fragment statistical information about indexes on NDB tables. This includes cache version and age, number of index entries per partition, and memory consumption by indexes.

Usage

To obtain basic index statistics about a given NDB table, invoke ndb_index_stat as shown here, with the name of the table as the first argument and the name of the database containing this table specified immediately following it, using the --database (-d) option:

ndb_index_stat table -d database

In this example, we use ndb_index_stat to obtain such information about an NDB table named mytable in the test database:

shell> ndb_index_stat -d test mytable
table:City index:PRIMARY fragCount:2
sampleVersion:3 loadTime:1399585986 sampleCount:1994 keyBytes:7976
query cache: valid:1 sampleCount:1994 totalBytes:27916
times in ms: save: 7.133 sort: 1.974 sort per sample: 0.000

NDBT_ProgramExit: 0 - OK

sampleVersion is the version number of the cache from which the statistics data is taken. Running ndb_index_stat with the --update option causes sampleVersion to be incremented.

loadTime shows when the cache was last updated. This is expressed as seconds since the Unix Epoch.

sampleCount is the number of index entries found per partition. You can estimate the total number of entries by multiplying this by the number of fragments (shown as fragCount).

sampleCount can be compared with the cardinality of SHOW INDEX or INFORMATION_SCHEMA.STATISTICS, although the latter two provide a view of the table as a whole, while ndb_index_stat provides a per-fragment average.

keyBytes is the number of bytes used by the index. In this example, the primary key is an integer, which requires four bytes for each index, so keyBytes can be calculated in this case as shown here:

    keyBytes = sampleCount * (4 bytes per index) = 1994 * 4 = 7976

This information can also be obtained using the corresponding column definitions from INFORMATION_SCHEMA.COLUMNS (this requires a MySQL Server and a MySQL client application).

totalBytes is the total memory consumed by all indexes on the table, in bytes.

Timings shown in the preceding examples are specific to each invocation of ndb_index_stat.

The --verbose option provides some additional output, as shown here:

shell> ndb_index_stat -d test mytable --verbose
random seed 1337010518
connected
loop 1 of 1
table:mytable index:PRIMARY fragCount:4
sampleVersion:2 loadTime:1336751773 sampleCount:0 keyBytes:0
read stats
query cache created
query cache: valid:1 sampleCount:0 totalBytes:0
times in ms: save: 20.766 sort: 0.001
disconnected

NDBT_ProgramExit: 0 - OK

shell>

Options

The following table includes options that are specific to the MySQL Cluster ndb_index_stat utility. Additional descriptions are listed following the table. For options common to most MySQL Cluster programs (including ndb_index_stat), see Section 18.4.27, “Options Common to MySQL Cluster Programs — Options Common to MySQL Cluster Programs”.

Table 18.91 This table describes command-line options for the ndb_index_stat program

Format Description Added or Removed

--database=name,

-d

Name of the database containing the table.

All MySQL 5.6 based releases

--delete

Delete index statistics for the given table, stopping any auto-update previously configured.

All MySQL 5.6 based releases

--update

Update index statistics for the given table, restarting any auto-update previously configured.

All MySQL 5.6 based releases

--dump

Print the query cache.

All MySQL 5.6 based releases

--query=#

Perform a number of random range queries on first key attr (must be int unsigned).

All MySQL 5.6 based releases

--sys-drop

Drop any statistics tables and events in NDB kernel (all statistics are lost)

All MySQL 5.6 based releases

--sys-create

Create all statistics tables and events in NDB kernel, if none of them already exist

All MySQL 5.6 based releases

--sys-create-if-not-exist

Create any statistics tables and events in NDB kernel that do not already exist.

All MySQL 5.6 based releases

--sys-create-if-not-valid

Create any statistics tables or events that do not already exist in the NDB kernel. after dropping any that are invalid.

All MySQL 5.6 based releases

--sys-check

Verify that NDB system index statistics and event tables exist.

All MySQL 5.6 based releases

--sys-skip-tables

Do not apply sys-* options to tables.

All MySQL 5.6 based releases

--sys-skip-events

Do not apply sys-* options to events.

All MySQL 5.6 based releases

--verbose,

-v

Turn on verbose output

All MySQL 5.6 based releases

--loops=#

Set the number of times to perform a given command. Default is 0.

All MySQL 5.6 based releases


ndb_index_stat statistics options.  The following options are used to generate index statistics. They work with a given table and database. They cannot be mixed with system options (see ndb_index_stat system options).

  • --database=name, -d name

    Command-Line Format--database=name
    Permitted ValuesTypestring
    Default[none]
    Min Value
    Max Value

    The name of the database that contains the table being queried.

  • --delete

    Command-Line Format--delete
    Permitted ValuesTypeboolean
    Defaultfalse
    Min Value
    Max Value

    Delete the index statistics for the given table, stopping any auto-update that was previously configured.

  • --update

    Command-Line Format--update
    Permitted ValuesTypeboolean
    Defaultfalse
    Min Value
    Max Value

    Update the index statistics for the given table, and restart any auto-update that was previously configured.

  • --dump

    Command-Line Format--dump
    Permitted ValuesTypeboolean
    Defaultfalse
    Min Value
    Max Value

    Dump the contents of the query cache.

  • --query=#

    Command-Line Format--query=#
    Permitted ValuesTypenumeric
    Default0
    Min Value0
    Max ValueMAX_INT

    Perform random range queries on first key attribute (must be int unsigned).

ndb_index_stat system options.  The following options are used to generate and update the statistics tables in the NDB kernel. None of these options can be mixed with statistics options (see ndb_index_stat statistics options).

  • --sys-drop

    Command-Line Format--sys-drop
    Permitted ValuesTypeboolean
    Defaultfalse
    Min Value
    Max Value

    Drop all statistics tables and events in the NDB kernel. This causes all statistics to be lost.

  • --sys-create

    Command-Line Format--sys-create
    Permitted ValuesTypeboolean
    Defaultfalse
    Min Value
    Max Value

    Create all statistics tables and events in the NDB kernel. This works only if none of them exist previously.

  • sys-create-if-not-exist

    Command-Line Format--sys-create-if-not-exist
    Permitted ValuesTypeboolean
    Defaultfalse
    Min Value
    Max Value

    Create any NDB system statistics tables or events (or both) that do not already exist when the program is invoked.

  • --sys-create-if-not-valid

    Command-Line Format--sys-create-if-not-valid
    Permitted ValuesTypeboolean
    Defaultfalse
    Min Value
    Max Value

    Create any NDB system statistics tables or events that do not already exist, after dropping any that are invalid.

  • --sys-check

    Command-Line Format--sys-check
    Permitted ValuesTypeboolean
    Defaultfalse
    Min Value
    Max Value

    Verify that all required system statistics tables and events exist in the NDB kernel.

  • --sys-skip-tables

    Command-Line Format--sys-skip-tables
    Permitted ValuesTypeboolean
    Defaultfalse
    Min Value
    Max Value

    Do not apply any --sys-* options to any statistics tables.

  • --sys-skip-events

    Command-Line Format--sys-skip-events
    Permitted ValuesTypeboolean
    Defaultfalse
    Min Value
    Max Value

    Do not apply any --sys-* options to any events.

  • --verbose

    Command-Line Format--verbose
    Permitted ValuesTypeboolean
    Defaultfalse
    Min Value
    Max Value

    Turn on verbose output.

  • --loops=#

    Command-Line Format--loops=#
    Permitted ValuesTypenumeric
    Default0
    Min Value0
    Max ValueMAX_INT

    Repeat commands this number of times (for use in testing).


User Comments
Sign Up Login You must be logged in to post a comment.