You are viewing an older version of this section. View current production version.

SHOW DATABASE STATUS

Shows MemSQL database status.

Syntax

[USING db_name] SHOW DATABASE STATUS

Remarks

In case of cluster replication, the viewpoints of the primary and secondary clusters may differ. In this case, the primary cluster is unaware of the secondary cluster, whereas the secondary cluster is aware of the primary cluster. Hence, the command may return different results when run.

The following table provides information on the metrics displayed in the output:

Key Description
database Name of the database in the MemSQL instance
role Database replication role
state Current state of the database (See Database States for more information)
commit_count Number of committed transactions
provision_file Position (of the snapshot) from which the database has been provisioned
log_type Durability type of the log, sequential or paged
commit_lsn Position before which all pages are committed
hardened_lsn Position before which all pages have been written
replay_lsn Position before which all pages have been replayed. Applies only to secondary databases
tail_lsn Highest position of all the pages
term The term of the database, used to uniquely identify which node was the master of a specific database
replay_fileid Used in combination with replay_offset to find the current replay position
sync_offset This field is deprecated
replay_offset (secondary) Used in combination with replay_fileid to find the current replay position
network_fileid (secondary) Used in combination with network_offset to find the position in log file that has been replicated
network_offset (secondary) Used in combination with network_fileid to find the position before which the log file has been replicated
is_connected_to_master (secondary) Specifies if the secondary partition is connected to the primary partition
replication_type (secondary) Specifies the replication type (async or sync). This metric is local to the secondary database, and can be different from the distributed database’s replication state
master_host (secondary) The host component (of the primary database) in the host:port/database_name URI format
master_port (secondary) The port component (of the primary database) in the host:port/database_name URI format
master_user (secondary) Name of the user
master_database (secondary) The name of the primary database
auto_reprovision (secondary) This field is deprecated
partitions The number of partitions. This value is non-zero for reference databases and zero for partitions and other databases

Note: LSN stands for Log Sequence Number, and represents the position in the log file.

Examples

The following example shows the output when the command is run on the primary cluster.

USE memsql_demo;

SHOW DATABASE STATUS;
****
+----------------+-------------+
| Key            | Value       |
+----------------+-------------+
| database       | memsql_demo |
| role           | master      |
| state          | online      |
| commit_count   | 20          |
| provision_file | S0          |
| log_type       | sequential  |
| commit_lsn     | 0:15554     |
| hardened_lsn   | 0:15554     |
| replay_lsn     | 0:15554     |
| tail_lsn       | 0:15554     |
| term           | 1727807     |
| replay_fileid  | 0           |
| sync_offset    | 15554       |
| partitions     | 12          |
+----------------+-------------+

The following example displays the output from the secondary cluster’s viewpoint.

USE memsql_demo;

SHOW DATABASE STATUS;
****
+------------------------+-------------+
| Key                    | Value       |
+------------------------+-------------+
| database               | memsql_demo |
| role                   | slave       |
| state                  | replicating |
| commit_count           | 20          |
| provision_file         | S0          |
| log_type               | sequential  |
| commit_lsn             | 0:15554     |
| hardened_lsn           | 0:15554     |
| replay_lsn             | 0:15554     |
| tail_lsn               | 0:15554     |
| term                   | 1           |
| replay_fileid          | 0           |
| replay_offset          | 15554       |
| network_fileid         | 0           |
| network_offset         | 15554       |
| is_connected_to_master | yes         |
| replication_type       | async       |
| master_host            | 10.0.0.136  |
| master_port            | 3306        |
| master_user            | distributed |
| master_database        | memsql_demo |
| auto_reprovision       | yes         |
| partitions             | 12          |
+------------------------+-------------+