Rechercher dans le manuel MySQL

22.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>

If the only output from the program is NDBT_ProgramExit: 0 - OK, this may indicate that no statistics yet exist. To force them to be created (or updated if they already exist), invoke ndb_index_stat with the --update option, or execute ANALYZE TABLE on the table in the mysql client.

Options

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

Table 22.346 Command-line options for the ndb_index_stat program

Format Description Added, Deprecated, or Removed

--database=name,

-d

Name of the database containing the table.

All NDB 8.0 releases

--delete

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

All NDB 8.0 releases

--update

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

All NDB 8.0 releases

--dump

Print the query cache.

All NDB 8.0 releases

--query=#

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

All NDB 8.0 releases

--sys-drop

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

All NDB 8.0 releases

--sys-create

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

All NDB 8.0 releases

--sys-create-if-not-exist

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

All NDB 8.0 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 NDB 8.0 releases

--sys-check

Verify that NDB system index statistics and event tables exist.

All NDB 8.0 releases

--sys-skip-tables

Do not apply sys-* options to tables.

All NDB 8.0 releases

--sys-skip-events

Do not apply sys-* options to events.

All NDB 8.0 releases

--verbose,

-v

Turn on verbose output

All NDB 8.0 releases

--loops=#

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

All NDB 8.0 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

    Property Value
    Command-Line Format --database=name
    Type String
    Default Value [none]
    Minimum Value
    Maximum Value

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

  • --delete

    Property Value
    Command-Line Format --delete
    Type Boolean
    Default Value false
    Minimum Value
    Maximum Value

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

  • --update

    Property Value
    Command-Line Format --update
    Type Boolean
    Default Value false
    Minimum Value
    Maximum Value

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

  • --dump

    Property Value
    Command-Line Format --dump
    Type Boolean
    Default Value false
    Minimum Value
    Maximum Value

    Dump the contents of the query cache.

  • --query=#

    Property Value
    Command-Line Format --query=#
    Type Numeric
    Default Value 0
    Minimum Value 0
    Maximum Value MAX_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

    Property Value
    Command-Line Format --sys-drop
    Type Boolean
    Default Value false
    Minimum Value
    Maximum Value

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

  • --sys-create

    Property Value
    Command-Line Format --sys-create
    Type Boolean
    Default Value false
    Minimum Value
    Maximum 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

    Property Value
    Command-Line Format --sys-create-if-not-exist
    Type Boolean
    Default Value false
    Minimum Value
    Maximum 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

    Property Value
    Command-Line Format --sys-create-if-not-valid
    Type Boolean
    Default Value false
    Minimum Value
    Maximum Value

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

  • --sys-check

    Property Value
    Command-Line Format --sys-check
    Type Boolean
    Default Value false
    Minimum Value
    Maximum Value

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

  • --sys-skip-tables

    Property Value
    Command-Line Format --sys-skip-tables
    Type Boolean
    Default Value false
    Minimum Value
    Maximum Value

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

  • --sys-skip-events

    Property Value
    Command-Line Format --sys-skip-events
    Type Boolean
    Default Value false
    Minimum Value
    Maximum Value

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

  • --verbose

    Property Value
    Command-Line Format --verbose
    Type Boolean
    Default Value false
    Minimum Value
    Maximum Value

    Turn on verbose output.

  • --loops=#

    Property Value
    Command-Line Format --loops=#
    Type Numeric
    Default Value 0
    Minimum Value 0
    Maximum Value MAX_INT

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


Find a PHP function

Document created the 26/06/2006, last modified the 26/10/2018
Source of the printed document:https://www.gaudry.be/en/mysql-rf-mysql-cluster-programs-ndb-index-stat.html

The infobrol is a personal site whose content is my sole responsibility. The text is available under CreativeCommons license (BY-NC-SA). More info on the terms of use and the author.

References

  1. View the html document Language of the document:en Manuel MySQL : https://dev.mysql.com/

These references and links indicate documents consulted during the writing of this page, or which may provide additional information, but the authors of these sources can not be held responsible for the content of this page.
The author This site is solely responsible for the way in which the various concepts, and the freedoms that are taken with the reference works, are presented here. Remember that you must cross multiple source information to reduce the risk of errors.

Contents Haut