Spec-Zone .ru
спецификации, руководства, описания, API
|
ndb_desc
provides a detailed description of one or more NDB
tables.
ndb_desc -cconnect_string
tbl_name
-ddb_name
[-p] ndb_desc -cconnect_string
index_name
-ddb_name
-ttbl_name
MySQL table creation and population statements:
USE test;CREATE TABLE fish ( id INT(11) NOT NULL AUTO_INCREMENT, name VARCHAR(20) NOT NULL, length_mm INT(11) NOT NULL, weight_gm INT(11) NOT NULL, PRIMARY KEY pk (id), UNIQUE KEY uk (name)) ENGINE=NDB;INSERT INTO fish VALUES ('','guppy', 35, 2), ('','tuna', 2500, 150000), ('','shark', 3000, 110000), ('','manta ray', 1500, 50000), ('','grouper', 900, 125000), ('','puffer', 250, 2500);
Output from ndb_desc:
shell> ./ndb_desc -c localhost fish -d test -p
-- fish --Version: 2Fragment type: 9K Value: 6Min load factor: 78Max load factor: 80Temporary table: noNumber of attributes: 4Number of primary keys: 1Length of frm data: 311Row Checksum: 1Row GCI: 1SingleUserMode: 0ForceVarPart: 1FragmentCount: 2TableStatus: Retrieved-- Attributes --id Int PRIMARY KEY DISTRIBUTION KEY AT=FIXED ST=MEMORY AUTO_INCRname Varchar(20;latin1_swedish_ci) NOT NULL AT=SHORT_VAR ST=MEMORYlength_mm Int NOT NULL AT=FIXED ST=MEMORYweight_gm Int NOT NULL AT=FIXED ST=MEMORY-- Indexes --PRIMARY KEY(id) - UniqueHashIndexPRIMARY(id) - OrderedIndexuk$unique(name) - UniqueHashIndexuk(name) - OrderedIndex-- Per partition info --Partition Row count Commit count Frag fixed memory ...0 2 2 32768 ...1 4 4 32768 ...... Frag varsized memory Extent_space Free extent_space... 32768 0 0... 32768 0 0NDBT_ProgramExit: 0 - OK
Information about multiple tables can be obtained in a single invocation of ndb_desc by using their names, separated by spaces. All of the tables must be in the same database.
You can obtain additional information about a specific index using the --table
(short form: -t
) option supplying the name of the index as the first argument to ndb_desc, as shown here:
shell> ./ndb_desc uk -d test -t fish
-- uk --Version: 3Base table: fishNumber of attributes: 1Logging: 0Index type: OrderedIndexIndex status: Retrieved-- Attributes --name Varchar(20;latin1_swedish_ci) NOT NULL AT=SHORT_VAR ST=MEMORY-- IndexTable 10/uk --Version: 3Fragment type: FragUndefinedK Value: 6Min load factor: 78Max load factor: 80Temporary table: yesNumber of attributes: 2Number of primary keys: 1Length of frm data: 0Row Checksum: 1Row GCI: 1SingleUserMode: 2ForceVarPart: 0FragmentCount: 4ExtraRowGciBits: 0ExtraRowAuthorBits: 0TableStatus: Retrieved-- Attributes --name Varchar(20;latin1_swedish_ci) NOT NULL AT=SHORT_VAR ST=MEMORYNDB$TNODE Unsigned [64] PRIMARY KEY DISTRIBUTION KEY AT=FIXED ST=MEMORY-- Indexes -- PRIMARY KEY(NDB$TNODE) - UniqueHashIndexNDBT_ProgramExit: 0 - OK
When an index is specified in this way, the --extra-partition-info
and --extra-node-info
options have no effect.
The Version
column in the output contains the table's schema object version. For
information about interpreting this value, see
The Extent_space
and Free extent_space
columns are
applicable only to NDB
tables having columns on disk; for tables having only
in-memory columns, these columns always contain the value 0
.
To illustrate their use, we modify the previous example. First, we must create the necessary Disk Data objects, as shown here:
CREATE LOGFILE GROUP lg_1 ADD UNDOFILE 'undo_1.log' INITIAL_SIZE 16M UNDO_BUFFER_SIZE 2M ENGINE NDB;ALTER LOGFILE GROUP lg_1 ADD UNDOFILE 'undo_2.log' INITIAL_SIZE 12M ENGINE NDB;CREATE TABLESPACE ts_1 ADD DATAFILE 'data_1.dat' USE LOGFILE GROUP lg_1 INITIAL_SIZE 32M ENGINE NDB;ALTER TABLESPACE ts_1 ADD DATAFILE 'data_2.dat' INITIAL_SIZE 48M ENGINE NDB;
(For more information on the statements just shown and the objects created by them, see Section
17.5.12.1, "MySQL Cluster Disk Data Objects", as well as Section
13.1.14, "CREATE LOGFILE GROUP
Syntax", and Section
13.1.18, "CREATE TABLESPACE
Syntax".)
Now we can create and populate a version of the fish
table that stores 2 of its
columns on disk (deleting the previous version of the table first, if it already exists):
CREATE TABLE fish ( id INT(11) NOT NULL AUTO_INCREMENT, name VARCHAR(20) NOT NULL, length_mm INT(11) NOT NULL, weight_gm INT(11) NOT NULL, PRIMARY KEY pk (id), UNIQUE KEY uk (name)) TABLESPACE ts_1 STORAGE DISK ENGINE=NDB;INSERT INTO fish VALUES ('','guppy', 35, 2), ('','tuna', 2500, 150000), ('','shark', 3000, 110000), ('','manta ray', 1500, 50000), ('','grouper', 900, 125000), ('','puffer', 250, 2500);
When run against this version of the table, ndb_desc displays the following output:
shell> ./ndb_desc -c localhost fish -d test -p
-- fish --Version: 3Fragment type: 9K Value: 6Min load factor: 78Max load factor: 80Temporary table: noNumber of attributes: 4Number of primary keys: 1Length of frm data: 321Row Checksum: 1Row GCI: 1SingleUserMode: 0ForceVarPart: 1FragmentCount: 2TableStatus: Retrieved-- Attributes --id Int PRIMARY KEY DISTRIBUTION KEY AT=FIXED ST=MEMORY AUTO_INCRname Varchar(20;latin1_swedish_ci) NOT NULL AT=SHORT_VAR ST=MEMORYlength_mm Int NOT NULL AT=FIXED ST=DISKweight_gm Int NOT NULL AT=FIXED ST=DISK-- Indexes --PRIMARY KEY(id) - UniqueHashIndexPRIMARY(id) - OrderedIndexuk$unique(name) - UniqueHashIndexuk(name) - OrderedIndex-- Per partition info --Partition Row count Commit count Frag fixed memory ...0 2 2 32768 ...1 4 4 32768 ...... Frag varsized memory Extent_space Free extent_space... 32768 0 0... 32768 0 0NDBT_ProgramExit: 0 - OK
This means that 1048576 bytes are allocated from the tablespace for this table on each partition, of which
1044440 bytes remain free for additional storage. In other words, 1048576 - 1044440 = 4136 bytes per partition
is currently being used to store the data from this table's disk-based columns. The number of bytes shown as
Free extent_space
is available for storing on-disk column data from the fish
table only; for this reason, it is not visible when selecting from the INFORMATION_SCHEMA.FILES
table.
The following table includes options that are specific to ndb_desc. Additional descriptions follow the table. For options common to most MySQL Cluster programs (including ndb_desc), see Section 17.4.25, "Options Common to MySQL Cluster Programs — Options Common to MySQL Cluster Programs".
Table 17.16. ndb_desc Options and Variables: MySQL Cluster NDB 7.3
Format | Description | Added / Removed |
---|---|---|
Include partition information for BLOB tables in output. Requires that the -p option also be used | All MySQL 5.6 based releases |
|
Name of database containing table | All MySQL 5.6 based releases |
|
Include partition-to-data-node mappings in output. Requires that the -p option also be used | All MySQL 5.6 based releases |
|
Display information about partitions | All MySQL 5.6 based releases |
|
Number of times to retry the connection (once per second) | All MySQL 5.6 based releases |
|
Specify the table in which to find an index. When this option is used, -p and -n have no effect and are ignored. | All MySQL 5.6 based releases |
|
Use unqualified table names | All MySQL 5.6 based releases |
Include information about subordinate BLOB
and TEXT
columns.
Use of this option also requires the use of the --extra-partition-info
(-p
) option.
Specify the database in which the table should be found.
Include information about the mappings between table partitions and the data nodes upon which they reside. This information can be useful for verifying distribution awareness mechanisms and supporting more efficient application access to the data stored in MySQL Cluster.
Use of this option also requires the use of the --extra-partition-info
(-p
) option.
Print additional information about the table's partitions.
Try to connect this many times before giving up. One connect attempt is made per second.
Specify the table in which to look for an index.
Use unqualified table names.