Rechercher dans le manuel MySQL

22.5.17 NDB API Statistics Counters and Variables

A number of types of statistical counters relating to actions performed by or affecting Ndb objects are available. Such actions include starting and closing (or aborting) transactions; primary key and unique key operations; table, range, and pruned scans; threads blocked while waiting for the completion of various operations; and data and events sent and received by NDBCLUSTER. The counters are incremented inside the NDB kernel whenever NDB API calls are made or data is sent to or received by the data nodes. mysqld exposes these counters as system status variables; their values can be read in the output of SHOW STATUS, or by querying the INFORMATION_SCHEMA.SESSION_STATUS or INFORMATION_SCHEMA.GLOBAL_STATUS table. By comparing the values before and after statements operating on NDB tables, you can observe the corresponding actions taken on the API level, and thus the cost of performing the statement.

You can list all of these status variables using the following SHOW STATUS statement:

  1. mysql> SHOW STATUS LIKE 'ndb_api%';
  2. +--------------------------------------------+----------+
  3. | Variable_name                              | Value    |
  4. +--------------------------------------------+----------+
  5. | Ndb_api_wait_exec_complete_count_session   | 0        |
  6. | Ndb_api_wait_scan_result_count_session     | 0        |
  7. | Ndb_api_wait_meta_request_count_session    | 0        |
  8. | Ndb_api_wait_nanos_count_session           | 0        |
  9. | Ndb_api_bytes_sent_count_session           | 0        |
  10. | Ndb_api_bytes_received_count_session       | 0        |
  11. | Ndb_api_trans_start_count_session          | 0        |
  12. | Ndb_api_trans_commit_count_session         | 0        |
  13. | Ndb_api_trans_abort_count_session          | 0        |
  14. | Ndb_api_trans_close_count_session          | 0        |
  15. | Ndb_api_pk_op_count_session                | 0        |
  16. | Ndb_api_uk_op_count_session                | 0        |
  17. | Ndb_api_table_scan_count_session           | 0        |
  18. | Ndb_api_range_scan_count_session           | 0        |
  19. | Ndb_api_pruned_scan_count_session          | 0        |
  20. | Ndb_api_scan_batch_count_session           | 0        |
  21. | Ndb_api_read_row_count_session             | 0        |
  22. | Ndb_api_trans_local_read_row_count_session | 0        |
  23. | Ndb_api_event_data_count_injector          | 0        |
  24. | Ndb_api_event_nondata_count_injector       | 0        |
  25. | Ndb_api_event_bytes_count_injector         | 0        |
  26. | Ndb_api_wait_exec_complete_count_slave     | 0        |
  27. | Ndb_api_wait_scan_result_count_slave       | 0        |
  28. | Ndb_api_wait_meta_request_count_slave      | 0        |
  29. | Ndb_api_wait_nanos_count_slave             | 0        |
  30. | Ndb_api_bytes_sent_count_slave             | 0        |
  31. | Ndb_api_bytes_received_count_slave         | 0        |
  32. | Ndb_api_trans_start_count_slave            | 0        |
  33. | Ndb_api_trans_commit_count_slave           | 0        |
  34. | Ndb_api_trans_abort_count_slave            | 0        |
  35. | Ndb_api_trans_close_count_slave            | 0        |
  36. | Ndb_api_pk_op_count_slave                  | 0        |
  37. | Ndb_api_uk_op_count_slave                  | 0        |
  38. | Ndb_api_table_scan_count_slave             | 0        |
  39. | Ndb_api_range_scan_count_slave             | 0        |
  40. | Ndb_api_pruned_scan_count_slave            | 0        |
  41. | Ndb_api_scan_batch_count_slave             | 0        |
  42. | Ndb_api_read_row_count_slave               | 0        |
  43. | Ndb_api_trans_local_read_row_count_slave   | 0        |
  44. | Ndb_api_wait_exec_complete_count           | 2        |
  45. | Ndb_api_wait_scan_result_count             | 3        |
  46. | Ndb_api_wait_meta_request_count            | 27       |
  47. | Ndb_api_wait_nanos_count                   | 45612023 |
  48. | Ndb_api_bytes_sent_count                   | 992      |
  49. | Ndb_api_bytes_received_count               | 9640     |
  50. | Ndb_api_trans_start_count                  | 2        |
  51. | Ndb_api_trans_commit_count                 | 1        |
  52. | Ndb_api_trans_abort_count                  | 0        |
  53. | Ndb_api_trans_close_count                  | 2        |
  54. | Ndb_api_pk_op_count                        | 1        |
  55. | Ndb_api_uk_op_count                        | 0        |
  56. | Ndb_api_table_scan_count                   | 1        |
  57. | Ndb_api_range_scan_count                   | 0        |
  58. | Ndb_api_pruned_scan_count                  | 0        |
  59. | Ndb_api_scan_batch_count                   | 0        |
  60. | Ndb_api_read_row_count                     | 1        |
  61. | Ndb_api_trans_local_read_row_count         | 1        |
  62. | Ndb_api_event_data_count                   | 0        |
  63. | Ndb_api_event_nondata_count                | 0        |
  64. | Ndb_api_event_bytes_count                  | 0        |
  65. +--------------------------------------------+----------+
  66. 60 rows in set (0.02 sec)

These status variables are also available from the SESSION_STATUS and GLOBAL_STATUS tables of the INFORMATION_SCHEMA database, as shown here:

  1. mysql> SELECT * FROM INFORMATION_SCHEMA.SESSION_STATUS
  2.     ->   WHERE VARIABLE_NAME LIKE 'ndb_api%';
  3. +--------------------------------------------+----------------+
  4. | VARIABLE_NAME                              | VARIABLE_VALUE |
  5. +--------------------------------------------+----------------+
  6. | NDB_API_WAIT_EXEC_COMPLETE_COUNT_SESSION   | 2              |
  7. | NDB_API_WAIT_SCAN_RESULT_COUNT_SESSION     | 0              |
  8. | NDB_API_WAIT_META_REQUEST_COUNT_SESSION    | 1              |
  9. | NDB_API_WAIT_NANOS_COUNT_SESSION           | 8144375        |
  10. | NDB_API_BYTES_SENT_COUNT_SESSION           | 68             |
  11. | NDB_API_BYTES_RECEIVED_COUNT_SESSION       | 84             |
  12. | NDB_API_TRANS_START_COUNT_SESSION          | 1              |
  13. | NDB_API_TRANS_COMMIT_COUNT_SESSION         | 1              |
  14. | NDB_API_TRANS_ABORT_COUNT_SESSION          | 0              |
  15. | NDB_API_TRANS_CLOSE_COUNT_SESSION          | 1              |
  16. | NDB_API_PK_OP_COUNT_SESSION                | 1              |
  17. | NDB_API_UK_OP_COUNT_SESSION                | 0              |
  18. | NDB_API_TABLE_SCAN_COUNT_SESSION           | 0              |
  19. | NDB_API_RANGE_SCAN_COUNT_SESSION           | 0              |
  20. | NDB_API_PRUNED_SCAN_COUNT_SESSION          | 0              |
  21. | NDB_API_SCAN_BATCH_COUNT_SESSION           | 0              |
  22. | NDB_API_READ_ROW_COUNT_SESSION             | 1              |
  23. | NDB_API_TRANS_LOCAL_READ_ROW_COUNT_SESSION | 1              |
  24. | NDB_API_EVENT_DATA_COUNT_INJECTOR          | 0              |
  25. | NDB_API_EVENT_NONDATA_COUNT_INJECTOR       | 0              |
  26. | NDB_API_EVENT_BYTES_COUNT_INJECTOR         | 0              |
  27. | NDB_API_WAIT_EXEC_COMPLETE_COUNT_SLAVE     | 0              |
  28. | NDB_API_WAIT_SCAN_RESULT_COUNT_SLAVE       | 0              |
  29. | NDB_API_WAIT_META_REQUEST_COUNT_SLAVE      | 0              |
  30. | NDB_API_WAIT_NANOS_COUNT_SLAVE             | 0              |
  31. | NDB_API_BYTES_SENT_COUNT_SLAVE             | 0              |
  32. | NDB_API_BYTES_RECEIVED_COUNT_SLAVE         | 0              |
  33. | NDB_API_TRANS_START_COUNT_SLAVE            | 0              |
  34. | NDB_API_TRANS_COMMIT_COUNT_SLAVE           | 0              |
  35. | NDB_API_TRANS_ABORT_COUNT_SLAVE            | 0              |
  36. | NDB_API_TRANS_CLOSE_COUNT_SLAVE            | 0              |
  37. | NDB_API_PK_OP_COUNT_SLAVE                  | 0              |
  38. | NDB_API_UK_OP_COUNT_SLAVE                  | 0              |
  39. | NDB_API_TABLE_SCAN_COUNT_SLAVE             | 0              |
  40. | NDB_API_RANGE_SCAN_COUNT_SLAVE             | 0              |
  41. | NDB_API_PRUNED_SCAN_COUNT_SLAVE            | 0              |
  42. | NDB_API_SCAN_BATCH_COUNT_SLAVE             | 0              |
  43. | NDB_API_READ_ROW_COUNT_SLAVE               | 0              |
  44. | NDB_API_TRANS_LOCAL_READ_ROW_COUNT_SLAVE   | 0              |
  45. | NDB_API_WAIT_EXEC_COMPLETE_COUNT           | 4              |
  46. | NDB_API_WAIT_SCAN_RESULT_COUNT             | 3              |
  47. | NDB_API_WAIT_META_REQUEST_COUNT            | 28             |
  48. | NDB_API_WAIT_NANOS_COUNT                   | 53756398       |
  49. | NDB_API_BYTES_SENT_COUNT                   | 1060           |
  50. | NDB_API_BYTES_RECEIVED_COUNT               | 9724           |
  51. | NDB_API_TRANS_START_COUNT                  | 3              |
  52. | NDB_API_TRANS_COMMIT_COUNT                 | 2              |
  53. | NDB_API_TRANS_ABORT_COUNT                  | 0              |
  54. | NDB_API_TRANS_CLOSE_COUNT                  | 3              |
  55. | NDB_API_PK_OP_COUNT                        | 2              |
  56. | NDB_API_UK_OP_COUNT                        | 0              |
  57. | NDB_API_TABLE_SCAN_COUNT                   | 1              |
  58. | NDB_API_RANGE_SCAN_COUNT                   | 0              |
  59. | NDB_API_PRUNED_SCAN_COUNT                  | 0              |
  60. | NDB_API_SCAN_BATCH_COUNT                   | 0              |
  61. | NDB_API_READ_ROW_COUNT                     | 2              |
  62. | NDB_API_TRANS_LOCAL_READ_ROW_COUNT         | 2              |
  63. | NDB_API_EVENT_DATA_COUNT                   | 0              |
  64. | NDB_API_EVENT_NONDATA_COUNT                | 0              |
  65. | NDB_API_EVENT_BYTES_COUNT                  | 0              |
  66. +--------------------------------------------+----------------+
  67. 60 rows in set (0.00 sec)
  68.  
  69. mysql> SELECT * FROM INFORMATION_SCHEMA.GLOBAL_STATUS
  70.     ->     WHERE VARIABLE_NAME LIKE 'ndb_api%';
  71. +--------------------------------------------+----------------+
  72. | VARIABLE_NAME                              | VARIABLE_VALUE |
  73. +--------------------------------------------+----------------+
  74. | NDB_API_WAIT_EXEC_COMPLETE_COUNT_SESSION   | 2              |
  75. | NDB_API_WAIT_SCAN_RESULT_COUNT_SESSION     | 0              |
  76. | NDB_API_WAIT_META_REQUEST_COUNT_SESSION    | 1              |
  77. | NDB_API_WAIT_NANOS_COUNT_SESSION           | 8144375        |
  78. | NDB_API_BYTES_SENT_COUNT_SESSION           | 68             |
  79. | NDB_API_BYTES_RECEIVED_COUNT_SESSION       | 84             |
  80. | NDB_API_TRANS_START_COUNT_SESSION          | 1              |
  81. | NDB_API_TRANS_COMMIT_COUNT_SESSION         | 1              |
  82. | NDB_API_TRANS_ABORT_COUNT_SESSION          | 0              |
  83. | NDB_API_TRANS_CLOSE_COUNT_SESSION          | 1              |
  84. | NDB_API_PK_OP_COUNT_SESSION                | 1              |
  85. | NDB_API_UK_OP_COUNT_SESSION                | 0              |
  86. | NDB_API_TABLE_SCAN_COUNT_SESSION           | 0              |
  87. | NDB_API_RANGE_SCAN_COUNT_SESSION           | 0              |
  88. | NDB_API_PRUNED_SCAN_COUNT_SESSION          | 0              |
  89. | NDB_API_SCAN_BATCH_COUNT_SESSION           | 0              |
  90. | NDB_API_READ_ROW_COUNT_SESSION             | 1              |
  91. | NDB_API_TRANS_LOCAL_READ_ROW_COUNT_SESSION | 1              |
  92. | NDB_API_EVENT_DATA_COUNT_INJECTOR          | 0              |
  93. | NDB_API_EVENT_NONDATA_COUNT_INJECTOR       | 0              |
  94. | NDB_API_EVENT_BYTES_COUNT_INJECTOR         | 0              |
  95. | NDB_API_WAIT_EXEC_COMPLETE_COUNT_SLAVE     | 0              |
  96. | NDB_API_WAIT_SCAN_RESULT_COUNT_SLAVE       | 0              |
  97. | NDB_API_WAIT_META_REQUEST_COUNT_SLAVE      | 0              |
  98. | NDB_API_WAIT_NANOS_COUNT_SLAVE             | 0              |
  99. | NDB_API_BYTES_SENT_COUNT_SLAVE             | 0              |
  100. | NDB_API_BYTES_RECEIVED_COUNT_SLAVE         | 0              |
  101. | NDB_API_TRANS_START_COUNT_SLAVE            | 0              |
  102. | NDB_API_TRANS_COMMIT_COUNT_SLAVE           | 0              |
  103. | NDB_API_TRANS_ABORT_COUNT_SLAVE            | 0              |
  104. | NDB_API_TRANS_CLOSE_COUNT_SLAVE            | 0              |
  105. | NDB_API_PK_OP_COUNT_SLAVE                  | 0              |
  106. | NDB_API_UK_OP_COUNT_SLAVE                  | 0              |
  107. | NDB_API_TABLE_SCAN_COUNT_SLAVE             | 0              |
  108. | NDB_API_RANGE_SCAN_COUNT_SLAVE             | 0              |
  109. | NDB_API_PRUNED_SCAN_COUNT_SLAVE            | 0              |
  110. | NDB_API_SCAN_BATCH_COUNT_SLAVE             | 0              |
  111. | NDB_API_READ_ROW_COUNT_SLAVE               | 0              |
  112. | NDB_API_TRANS_LOCAL_READ_ROW_COUNT_SLAVE   | 0              |
  113. | NDB_API_WAIT_EXEC_COMPLETE_COUNT           | 4              |
  114. | NDB_API_WAIT_SCAN_RESULT_COUNT             | 3              |
  115. | NDB_API_WAIT_META_REQUEST_COUNT            | 28             |
  116. | NDB_API_WAIT_NANOS_COUNT                   | 53756398       |
  117. | NDB_API_BYTES_SENT_COUNT                   | 1060           |
  118. | NDB_API_BYTES_RECEIVED_COUNT               | 9724           |
  119. | NDB_API_TRANS_START_COUNT                  | 3              |
  120. | NDB_API_TRANS_COMMIT_COUNT                 | 2              |
  121. | NDB_API_TRANS_ABORT_COUNT                  | 0              |
  122. | NDB_API_TRANS_CLOSE_COUNT                  | 3              |
  123. | NDB_API_PK_OP_COUNT                        | 2              |
  124. | NDB_API_UK_OP_COUNT                        | 0              |
  125. | NDB_API_TABLE_SCAN_COUNT                   | 1              |
  126. | NDB_API_RANGE_SCAN_COUNT                   | 0              |
  127. | NDB_API_PRUNED_SCAN_COUNT                  | 0              |
  128. | NDB_API_SCAN_BATCH_COUNT                   | 0              |
  129. | NDB_API_READ_ROW_COUNT                     | 2              |
  130. | NDB_API_TRANS_LOCAL_READ_ROW_COUNT         | 2              |
  131. | NDB_API_EVENT_DATA_COUNT                   | 0              |
  132. | NDB_API_EVENT_NONDATA_COUNT                | 0              |
  133. | NDB_API_EVENT_BYTES_COUNT                  | 0              |
  134. +--------------------------------------------+----------------+
  135. 60 rows in set (0.00 sec)

Each Ndb object has its own counters. NDB API applications can read the values of the counters for use in optimization or monitoring. For multithreaded clients which use more than one Ndb object concurrently, it is also possible to obtain a summed view of counters from all Ndb objects belonging to a given Ndb_cluster_connection.

Four sets of these counters are exposed. One set applies to the current session only; the other 3 are global. This is in spite of the fact that their values can be obtained as either session or global status variables in the mysql client. This means that specifying the SESSION or GLOBAL keyword with SHOW STATUS has no effect on the values reported for NDB API statistics status variables, and the value for each of these variables is the same whether the value is obtained from the equivalent column of the SESSION_STATUS or the GLOBAL_STATUS table.

  • Session counters (session specific)

    Session counters relate to the Ndb objects in use by (only) the current session. Use of such objects by other MySQL clients does not influence these counts.

    In order to minimize confusion with standard MySQL session variables, we refer to the variables that correspond to these NDB API session counters as _session variables, with a leading underscore.

  • Slave counters (global)

    This set of counters relates to the Ndb objects used by the replication slave SQL thread, if any. If this mysqld does not act as a replication slave, or does not use NDB tables, then all of these counts are 0.

    We refer to the related status variables as _slave variables (with a leading underscore).

  • Injector counters (global)

    Injector counters relate to the Ndb object used to listen to cluster events by the binary log injector thread. Even when not writing a binary log, mysqld processes attached to an NDB Cluster continue to listen for some events, such as schema changes.

    We refer to the status variables that correspond to NDB API injector counters as _injector variables (with a leading underscore).

  • Server (Global) counters (global)

    This set of counters relates to all Ndb objects currently used by this mysqld. This includes all MySQL client applications, the slave SQL thread (if any), the binlog injector, and the NDB utility thread.

    We refer to the status variables that correspond to these counters as global variables or mysqld-level variables.

You can obtain values for a particular set of variables by additionally filtering for the substring session, slave, or injector in the variable name (along with the common prefix Ndb_api). For _session variables, this can be done as shown here:

  1. mysql> SHOW STATUS LIKE 'ndb_api%session';
  2. +--------------------------------------------+---------+
  3. | Variable_name                              | Value   |
  4. +--------------------------------------------+---------+
  5. | Ndb_api_wait_exec_complete_count_session   | 2       |
  6. | Ndb_api_wait_scan_result_count_session     | 0       |
  7. | Ndb_api_wait_meta_request_count_session    | 1       |
  8. | Ndb_api_wait_nanos_count_session           | 8144375 |
  9. | Ndb_api_bytes_sent_count_session           | 68      |
  10. | Ndb_api_bytes_received_count_session       | 84      |
  11. | Ndb_api_trans_start_count_session          | 1       |
  12. | Ndb_api_trans_commit_count_session         | 1       |
  13. | Ndb_api_trans_abort_count_session          | 0       |
  14. | Ndb_api_trans_close_count_session          | 1       |
  15. | Ndb_api_pk_op_count_session                | 1       |
  16. | Ndb_api_uk_op_count_session                | 0       |
  17. | Ndb_api_table_scan_count_session           | 0       |
  18. | Ndb_api_range_scan_count_session           | 0       |
  19. | Ndb_api_pruned_scan_count_session          | 0       |
  20. | Ndb_api_scan_batch_count_session           | 0       |
  21. | Ndb_api_read_row_count_session             | 1       |
  22. | Ndb_api_trans_local_read_row_count_session | 1       |
  23. +--------------------------------------------+---------+
  24. 18 rows in set (0.50 sec)

To obtain a listing of the NDB API mysqld-level status variables, filter for variable names beginning with ndb_api and ending in _count, like this:

  1. mysql> SELECT * FROM INFORMATION_SCHEMA.SESSION_STATUS
  2.     ->     WHERE VARIABLE_NAME LIKE 'ndb_api%count';
  3. +------------------------------------+----------------+
  4. | VARIABLE_NAME                      | VARIABLE_VALUE |
  5. +------------------------------------+----------------+
  6. | NDB_API_WAIT_EXEC_COMPLETE_COUNT   | 4              |
  7. | NDB_API_WAIT_SCAN_RESULT_COUNT     | 3              |
  8. | NDB_API_WAIT_META_REQUEST_COUNT    | 28             |
  9. | NDB_API_WAIT_NANOS_COUNT           | 53756398       |
  10. | NDB_API_BYTES_SENT_COUNT           | 1060           |
  11. | NDB_API_BYTES_RECEIVED_COUNT       | 9724           |
  12. | NDB_API_TRANS_START_COUNT          | 3              |
  13. | NDB_API_TRANS_COMMIT_COUNT         | 2              |
  14. | NDB_API_TRANS_ABORT_COUNT          | 0              |
  15. | NDB_API_TRANS_CLOSE_COUNT          | 3              |
  16. | NDB_API_PK_OP_COUNT                | 2              |
  17. | NDB_API_UK_OP_COUNT                | 0              |
  18. | NDB_API_TABLE_SCAN_COUNT           | 1              |
  19. | NDB_API_RANGE_SCAN_COUNT           | 0              |
  20. | NDB_API_PRUNED_SCAN_COUNT          | 0              |
  21. | NDB_API_SCAN_BATCH_COUNT           | 0              |
  22. | NDB_API_READ_ROW_COUNT             | 2              |
  23. | NDB_API_TRANS_LOCAL_READ_ROW_COUNT | 2              |
  24. | NDB_API_EVENT_DATA_COUNT           | 0              |
  25. | NDB_API_EVENT_NONDATA_COUNT        | 0              |
  26. | NDB_API_EVENT_BYTES_COUNT          | 0              |
  27. +------------------------------------+----------------+
  28. 21 rows in set (0.09 sec)

Not all counters are reflected in all 4 sets of status variables. For the event counters DataEventsRecvdCount, NondataEventsRecvdCount, and EventBytesRecvdCount, only _injector and mysqld-level NDB API status variables are available:

  1. mysql> SHOW STATUS LIKE 'ndb_api%event%';
  2. +--------------------------------------+-------+
  3. | Variable_name                        | Value |
  4. +--------------------------------------+-------+
  5. | Ndb_api_event_data_count_injector    | 0     |
  6. | Ndb_api_event_nondata_count_injector | 0     |
  7. | Ndb_api_event_bytes_count_injector   | 0     |
  8. | Ndb_api_event_data_count             | 0     |
  9. | Ndb_api_event_nondata_count          | 0     |
  10. | Ndb_api_event_bytes_count            | 0     |
  11. +--------------------------------------+-------+
  12. 6 rows in set (0.00 sec)

_injector status variables are not implemented for any other NDB API counters, as shown here:

  1. mysql> SHOW STATUS LIKE 'ndb_api%injector%';
  2. +--------------------------------------+-------+
  3. | Variable_name                        | Value |
  4. +--------------------------------------+-------+
  5. | Ndb_api_event_data_count_injector    | 0     |
  6. | Ndb_api_event_nondata_count_injector | 0     |
  7. | Ndb_api_event_bytes_count_injector   | 0     |
  8. +--------------------------------------+-------+
  9. 3 rows in set (0.00 sec)

The names of the status variables can easily be associated with the names of the corresponding counters. Each NDB API statistics counter is listed in the following table with a description as well as the names of any MySQL server status variables corresponding to this counter.

Table 22.423 NDB API statistics counters

Counter Name Description Status Variables (by statistic type):
  • Session

  • Slave

  • Injector

  • Server

WaitExecCompleteCount Number of times thread has been blocked while waiting for execution of an operation to complete. Includes all execute() calls as well as implicit executes for blob operations and auto-increment not visible to clients.
WaitScanResultCount Number of times thread has been blocked while waiting for a scan-based signal, such waiting for additional results, or for a scan to close.
WaitMetaRequestCount Number of times thread has been blocked waiting for a metadata-based signal; this can occur when waiting for a DDL operation or for an epoch to be started (or ended).
WaitNanosCount Total time (in nanoseconds) spent waiting for some type of signal from the data nodes.
BytesSentCount Amount of data (in bytes) sent to the data nodes
BytesRecvdCount Amount of data (in bytes) received from the data nodes
TransStartCount Number of transactions started.
TransCommitCount Number of transactions committed.
TransAbortCount Number of transactions aborted.
TransCloseCount Number of transactions aborted. (This value may be greater than the sum of TransCommitCount and TransAbortCount.)
PkOpCount Number of operations based on or using primary keys. This count includes blob-part table operations, implicit unlocking operations, and auto-increment operations, as well as primary key operations normally visible to MySQL clients.
UkOpCount Number of operations based on or using unique keys.
TableScanCount Number of table scans that have been started. This includes scans of internal tables.
RangeScanCount Number of range scans that have been started.
PrunedScanCount Number of scans that have been pruned to a single partition.
ScanBatchCount Number of batches of rows received. (A batch in this context is a set of scan results from a single fragment.)
ReadRowCount Total number of rows that have been read. Includes rows read using primary key, unique key, and scan operations.
TransLocalReadRowCount Number of rows read from the data same node on which the transaction was being run.
DataEventsRecvdCount Number of row change events received.
NondataEventsRecvdCount Number of events received, other than row change events.
EventBytesRecvdCount Number of bytes of events received.

To see all counts of committed transactions—that is, all TransCommitCount counter status variables—you can filter the results of SHOW STATUS for the substring trans_commit_count, like this:

  1. mysql> SHOW STATUS LIKE '%trans_commit_count%';
  2. +------------------------------------+-------+
  3. | Variable_name                      | Value |
  4. +------------------------------------+-------+
  5. | Ndb_api_trans_commit_count_session | 1     |
  6. | Ndb_api_trans_commit_count_slave   | 0     |
  7. | Ndb_api_trans_commit_count         | 2     |
  8. +------------------------------------+-------+
  9. 3 rows in set (0.00 sec)

From this you can determine that 1 transaction has been committed in the current mysql client session, and 2 transactions have been committed on this mysqld since it was last restarted.

You can see how various NDB API counters are incremented by a given SQL statement by comparing the values of the corresponding _session status variables immediately before and after performing the statement. In this example, after getting the initial values from SHOW STATUS, we create in the test database an NDB table, named t, that has a single column:

  1. mysql> SHOW STATUS LIKE 'ndb_api%session%';
  2. +--------------------------------------------+--------+
  3. | Variable_name                              | Value  |
  4. +--------------------------------------------+--------+
  5. | Ndb_api_wait_exec_complete_count_session   | 2      |
  6. | Ndb_api_wait_scan_result_count_session     | 0      |
  7. | Ndb_api_wait_meta_request_count_session    | 3      |
  8. | Ndb_api_wait_nanos_count_session           | 820705 |
  9. | Ndb_api_bytes_sent_count_session           | 132    |
  10. | Ndb_api_bytes_received_count_session       | 372    |
  11. | Ndb_api_trans_start_count_session          | 1      |
  12. | Ndb_api_trans_commit_count_session         | 1      |
  13. | Ndb_api_trans_abort_count_session          | 0      |
  14. | Ndb_api_trans_close_count_session          | 1      |
  15. | Ndb_api_pk_op_count_session                | 1      |
  16. | Ndb_api_uk_op_count_session                | 0      |
  17. | Ndb_api_table_scan_count_session           | 0      |
  18. | Ndb_api_range_scan_count_session           | 0      |
  19. | Ndb_api_pruned_scan_count_session          | 0      |
  20. | Ndb_api_scan_batch_count_session           | 0      |
  21. | Ndb_api_read_row_count_session             | 1      |
  22. | Ndb_api_trans_local_read_row_count_session | 1      |
  23. +--------------------------------------------+--------+
  24. 18 rows in set (0.00 sec)
  25.  
  26. mysql> USE test;
  27. Database changed
  28. mysql> CREATE TABLE t (c INT) ENGINE NDBCLUSTER;
  29. Query OK, 0 rows affected (0.85 sec)

Now you can execute a new SHOW STATUS statement and observe the changes, as shown here (with the changed rows highlighted in the output):

  1. mysql> SHOW STATUS LIKE 'ndb_api%session%';
  2. +--------------------------------------------+-----------+
  3. | Variable_name                              | Value     |
  4. +--------------------------------------------+-----------+
  5. | Ndb_api_wait_exec_complete_count_session   | 8         |
  6. | Ndb_api_wait_scan_result_count_session     | 0         |
  7. | Ndb_api_wait_meta_request_count_session    | 17        |
  8. | Ndb_api_wait_nanos_count_session           | 706871709 |
  9. | Ndb_api_bytes_sent_count_session           | 2376      |
  10. | Ndb_api_bytes_received_count_session       | 3844      |
  11. | Ndb_api_trans_start_count_session          | 4         |
  12. | Ndb_api_trans_commit_count_session         | 4         |
  13. | Ndb_api_trans_abort_count_session          | 0         |
  14. | Ndb_api_trans_close_count_session          | 4         |
  15. | Ndb_api_pk_op_count_session                | 6         |
  16. | Ndb_api_uk_op_count_session                | 0         |
  17. | Ndb_api_table_scan_count_session           | 0         |
  18. | Ndb_api_range_scan_count_session           | 0         |
  19. | Ndb_api_pruned_scan_count_session          | 0         |
  20. | Ndb_api_scan_batch_count_session           | 0         |
  21. | Ndb_api_read_row_count_session             | 2         |
  22. | Ndb_api_trans_local_read_row_count_session | 1         |
  23. +--------------------------------------------+-----------+
  24. 18 rows in set (0.00 sec)

Similarly, you can see the changes in the NDB API statistics counters caused by inserting a row into t: Insert the row, then run the same SHOW STATUS statement used in the previous example, as shown here:

  1. mysql> INSERT INTO t VALUES (100);
  2. Query OK, 1 row affected (0.00 sec)
  3.  
  4. mysql> SHOW STATUS LIKE 'ndb_api%session%';
  5. +--------------------------------------------+-----------+
  6. | Variable_name                              | Value     |
  7. +--------------------------------------------+-----------+
  8. | Ndb_api_wait_exec_complete_count_session   | 11        |
  9. | Ndb_api_wait_scan_result_count_session     | 6         |
  10. | Ndb_api_wait_meta_request_count_session    | 20        |
  11. | Ndb_api_wait_nanos_count_session           | 707370418 |
  12. | Ndb_api_bytes_sent_count_session           | 2724      |
  13. | Ndb_api_bytes_received_count_session       | 4116      |
  14. | Ndb_api_trans_start_count_session          | 7         |
  15. | Ndb_api_trans_commit_count_session         | 6         |
  16. | Ndb_api_trans_abort_count_session          | 0         |
  17. | Ndb_api_trans_close_count_session          | 7         |
  18. | Ndb_api_pk_op_count_session                | 8         |
  19. | Ndb_api_uk_op_count_session                | 0         |
  20. | Ndb_api_table_scan_count_session           | 1         |
  21. | Ndb_api_range_scan_count_session           | 0         |
  22. | Ndb_api_pruned_scan_count_session          | 0         |
  23. | Ndb_api_scan_batch_count_session           | 0         |
  24. | Ndb_api_read_row_count_session             | 3         |
  25. | Ndb_api_trans_local_read_row_count_session | 2         |
  26. +--------------------------------------------+-----------+
  27. 18 rows in set (0.00 sec)

We can make a number of observations from these results:

  • Although we created t with no explicit primary key, 5 primary key operations were performed in doing so (the difference in the before and after values of Ndb_api_pk_op_count_session, or 6 minus 1). This reflects the creation of the hidden primary key that is a feature of all tables using the NDB storage engine.

  • By comparing successive values for Ndb_api_wait_nanos_count_session, we can see that the NDB API operations implementing the CREATE TABLE statement waited much longer (706871709 - 820705 = 706051004 nanoseconds, or approximately 0.7 second) for responses from the data nodes than those executed by the INSERT (707370418 - 706871709 = 498709 ns or roughly .0005 second). The execution times reported for these statements in the mysql client correlate roughly with these figures.

    On platforms without sufficient (nanosecond) time resolution, small changes in the value of the WaitNanosCount NDB API counter due to SQL statements that execute very quickly may not always be visible in the values of Ndb_api_wait_nanos_count_session, Ndb_api_wait_nanos_count_slave, or Ndb_api_wait_nanos_count.

  • The INSERT statement incremented both the ReadRowCount and TransLocalReadRowCount NDB API statistics counters, as reflected by the increased values of Ndb_api_read_row_count_session and Ndb_api_trans_local_read_row_count_session.


Zoek in de MySQL-handleiding

Nederlandse vertaling

U hebt gevraagd om deze site in het Nederlands te bezoeken. Voor nu wordt alleen de interface vertaald, maar nog niet alle inhoud.

Als je me wilt helpen met vertalingen, is je bijdrage welkom. Het enige dat u hoeft te doen, is u op de site registreren en mij een bericht sturen waarin u wordt gevraagd om u toe te voegen aan de groep vertalers, zodat u de gewenste pagina's kunt vertalen. Een link onderaan elke vertaalde pagina geeft aan dat u de vertaler bent en heeft een link naar uw profiel.

Bij voorbaat dank.

Document heeft de 26/06/2006 gemaakt, de laatste keer de 26/10/2018 gewijzigd
Bron van het afgedrukte document:https://www.gaudry.be/nl/mysql-rf-mysql-cluster-ndb-api-statistics.html

De infobrol is een persoonlijke site waarvan de inhoud uitsluitend mijn verantwoordelijkheid is. De tekst is beschikbaar onder CreativeCommons-licentie (BY-NC-SA). Meer info op de gebruiksvoorwaarden en de auteur.

Referenties

  1. Bekijk - html-document Taal van het document:en Manuel MySQL : https://dev.mysql.com/

Deze verwijzingen en links verwijzen naar documenten die geraadpleegd zijn tijdens het schrijven van deze pagina, of die aanvullende informatie kunnen geven, maar de auteurs van deze bronnen kunnen niet verantwoordelijk worden gehouden voor de inhoud van deze pagina.
De auteur Deze site is als enige verantwoordelijk voor de manier waarop de verschillende concepten, en de vrijheden die met de referentiewerken worden genomen, hier worden gepresenteerd. Vergeet niet dat u meerdere broninformatie moet doorgeven om het risico op fouten te verkleinen.

Inhoudsopgave Haut