obdiag analyze index_space can analyze the space size of created indexes and uncreated indexes (specified index columns) with one click. Analyzing the space size of the index to be created before creating the index is very helpful to prevent disk space alarms.
Instructions for use```
Plain Text obdiag analyze index_space [option]
The options are explained below:
| Option name | Is it required | Data type | Default value | Description |
| ------------- | -------- | -------- | -------- | ---------------------------------------- |
| \--tenant\_name | Yes | string | Default is empty | Tenant name |
| \--database | No | string | Default is empty | Database name |
| \--table\_name | Yes | string | Default is empty | Table name |
| \--index\_name | No | string | Default is empty | Index name |
| \--column\_names | No | string | Default is empty | Column names, specify multiple columns separated by commas, for example: `col1,col2,col3` |
| -c | No | string | `~/.obdiag/config.yml` | Configuration file path. |
| --inner_config | No | string | Default is empty | obdiag's own configuration. |
| --config | No | string | Default is empty | Configuration of the cluster to be diagnosed by obdiag, fixed style: --config key1=value1 --config key2=value2. <main id="notice" type='explain'><h4>Explanation</h4><p>Parameters that support configuration through this option can be found in <a href="../300.obdiag-config-guide.md">obdiag configuration</a>. </p></main> |
| --config_password | No | string | Default is empty | obdiag When using an encrypted configuration file, you need to pass in the corresponding password through this option. <main id="notice" type='explain'><h4>Explanation</h4><p>For details, please see <a href="../800.tool/801.crypto_config.md">Configuration file encryption</a>. </p></main> |
## Usage example
* Analyze existing index space size
```shell
$ obdiag analyze index_space --tenant_name=test --table_name=student --index_name=name_index
The output is as follows:
analyze_index_space start ...
start query estimated_table_data_size, please wait some minutes... ok
+--------------------------------------------------------------------+
| estimated-index-space-report |
+--------------+------+-----------------------+----------------------+
| ip | port | estimated_index_space | available_disk_space |
+--------------+------+-----------------------+----------------------+
| 10.10.10.1 | 2882 | 2.57 KB | 55.07 GB |
| 10.10.10.3 | 2882 | 2.57 KB | 55.07 GB |
| 10.10.10.2 | 2882 | 3.50 KB | 54.98 GB |
+--------------+------+-----------------------+----------------------+
Trace ID: 9cbf48b0-6a9f-11ef-82ec-000c2934fb31
If you want to view detailed obdiag logs, please run: main.py display-trace 9cbf48b0-6a9f-11ef-82ec-000c2934fb31
```* Analyze uncreated index space and analyze through index columns
```shell
$ obdiag analyze index_space --tenant_name=CHAT_BI --table_name=student --column_names=name
The output is as follows:
analyze_index_space start ...
start query estimated_table_data_size, please wait some minutes... ok
+--------------------------------------------------------------------+
| estimated-index-space-report |
+--------------+------+-----------------------+----------------------+
| ip | port | estimated_index_space | available_disk_space |
+--------------+------+-----------------------+----------------------+
| 10.10.10.1 | 2882 | 2.57 KB | 55.07 GB |
| 10.10.10.2 | 2882 | 3.50 KB | 54.98 GB |
| 10.10.10.3 | 2882 | 2.57 KB | 55.07 GB |
+--------------+------+-----------------------+----------------------+
Trace ID: e71c5cc2-6a9f-11ef-9373-000c2934fb31
If you want to view detailed obdiag logs, please run: main.py display-trace e71c5cc2-6a9f-11ef-9373-000c2934fb31
