Help Center/ GaussDB(for MySQL)/ Troubleshooting/ Basic Issues/ How Do I View Used Storage of My GaussDB(for MySQL) Instance?
Updated on 2023-10-19 GMT+08:00

How Do I View Used Storage of My GaussDB(for MySQL) Instance?

GaussDB(for MySQL) decouples compute and storage, so data is stored in the shared storage. You can view the used storage of your instance on the console and the used storage is updated every 30 minutes.

Procedure

  1. Log in to the management console.
  2. Click in the upper left corner and select a region and a project.
  3. Click in the upper left corner of the page, choose Database > GaussDB(for MySQL).
  4. On the Instances page, click the instance name to go to the Basic Information page.
  5. In the Storage/Backup Space area, view the used storage of your instance.

    Storage is calculated differently for GaussDB(for MySQL) and open-source MySQL. To query used storage of an open-source MySQL instance: run select sum(data_length+index_length+data_free) from information_schema.tables;

    To query used storage of a GaussDB(for MySQL) instance, log in to GaussDB(for MySQL) console or run show spaceusage;.

    Figure 1 Viewing the storage of a DB instance

    • Shared storage:
      • The total and used storage of your yearly/monthly instance is displayed.
      • If this storage is used up, storage grows as data volume increases and you will be billed on a pay-per-use basis for any additional storage. To keep costs down, make sure you scale up storage in a timely manner so you can take advantage of yearly/monthly rates.
    • Backup space:

      GaussDB(for MySQL) provides free backup storage equal to the amount of the used storage of your pay-per-use instances or the purchased storage of your yearly/monthly instance.

The following table describes the calculation items of GaussDB(for MySQL) instance storage.

Item

Command

Description

Table data

select sum(data_length+index_length+data_free) from information_schema.tables;

Size of table data. If the statistics data is not updated, the result may be inaccurate. Open-source MySQL uses this command to obtain the used storage of a DB instance.

Pre-allocated table space

select count(*) from information_schema.tables;

Pre-allocated space of tables. The statement is used to query the number of tables and the total pre-allocated space of tables is (Number of tables X 4 MB). The system pre-allocates 4 MB of storage to each table.

Pre-allocated partition space

select count(*) from INFORMATION_SCHEMA.PARTITIONS where PARTITION_NAME is not null;

Pre-allocated space of partitions. The statement is used to query the number of partitions and the total pre-allocated space of partitions is (Number of partitions X 4 MB). The system pre-allocates 4 MB of storage to each partition.

Binlog

show binary logs;

Total size of all binlog files.

Redolog

show lsninfo;

flushed_to_disk_lsn- truncate_lsn

Undolog

N/A

Size of undo logs. To obtain it, contact the customer service.