Files
greptimedb/tests/cases/standalone/common/show/show_columns.result
dennis zhuang e403133eb2 feat: add information_schema statistics table (#8253)
* feat: add information_schema statistics table

Signed-off-by: Dennis Zhuang <killme2008@gmail.com>

* fix: use index-local sequence in statistics

Signed-off-by: Dennis Zhuang <killme2008@gmail.com>

* fix: ordinal_position for pk

Signed-off-by: Dennis Zhuang <killme2008@gmail.com>

* fix: statistics.nullable uses empty string for non-nullable columns

Signed-off-by: Dennis Zhuang <killme2008@gmail.com>

---------

Signed-off-by: Dennis Zhuang <killme2008@gmail.com>
2026-06-08 12:52:02 +00:00

79 lines
4.9 KiB
Plaintext

CREATE TABLE IF NOT EXISTS system_metrics (
host STRING,
idc STRING,
cpu_util DOUBLE,
memory_util DOUBLE,
disk_util DOUBLE,
ts TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
PRIMARY KEY(host, idc),
TIME INDEX(ts)
);
Affected Rows: 0
SHOW COLUMNS;
Error: 2000(InvalidSyntax), Unexpected token while parsing SQL statement, expected: '{FROM | IN} table', found: ;
SHOW COLUMNS FROM system_metrics;
+-------------+--------------+------+------------+---------------------+-------+----------------------+
| Field | Type | Null | Key | Default | Extra | Greptime_type |
+-------------+--------------+------+------------+---------------------+-------+----------------------+
| cpu_util | double | YES | | | | Float64 |
| disk_util | double | YES | | | | Float64 |
| host | string | YES | PRI | | | String |
| idc | string | YES | PRI | | | String |
| memory_util | double | YES | | | | Float64 |
| ts | timestamp(3) | NO | TIME INDEX | current_timestamp() | | TimestampMillisecond |
+-------------+--------------+------+------------+---------------------+-------+----------------------+
SHOW COLUMNS FROM system_metrics in public;
+-------------+--------------+------+------------+---------------------+-------+----------------------+
| Field | Type | Null | Key | Default | Extra | Greptime_type |
+-------------+--------------+------+------------+---------------------+-------+----------------------+
| cpu_util | double | YES | | | | Float64 |
| disk_util | double | YES | | | | Float64 |
| host | string | YES | PRI | | | String |
| idc | string | YES | PRI | | | String |
| memory_util | double | YES | | | | Float64 |
| ts | timestamp(3) | NO | TIME INDEX | current_timestamp() | | TimestampMillisecond |
+-------------+--------------+------+------------+---------------------+-------+----------------------+
SHOW FULL COLUMNS FROM `system_metrics`;
+-------------+--------------+-----------+------+------------+---------------------+---------+---------------+-------+----------------------+
| Field | Type | Collation | Null | Key | Default | Comment | Privileges | Extra | Greptime_type |
+-------------+--------------+-----------+------+------------+---------------------+---------+---------------+-------+----------------------+
| cpu_util | double | | YES | | | | select,insert | | Float64 |
| disk_util | double | | YES | | | | select,insert | | Float64 |
| host | string | utf8_bin | YES | PRI | | | select,insert | | String |
| idc | string | utf8_bin | YES | PRI | | | select,insert | | String |
| memory_util | double | | YES | | | | select,insert | | Float64 |
| ts | timestamp(3) | | NO | TIME INDEX | current_timestamp() | | select,insert | | TimestampMillisecond |
+-------------+--------------+-----------+------+------------+---------------------+---------+---------------+-------+----------------------+
SHOW COLUMNS FROM system_metrics like '%util%';
+-------------+--------+------+-----+---------+-------+---------------+
| Field | Type | Null | Key | Default | Extra | Greptime_type |
+-------------+--------+------+-----+---------+-------+---------------+
| cpu_util | double | YES | | | | Float64 |
| disk_util | double | YES | | | | Float64 |
| memory_util | double | YES | | | | Float64 |
+-------------+--------+------+-----+---------+-------+---------------+
SHOW COLUMNS FROM system_metrics WHERE Field = 'cpu_util';
+----------+--------+------+-----+---------+-------+---------------+
| Field | Type | Null | Key | Default | Extra | Greptime_type |
+----------+--------+------+-----+---------+-------+---------------+
| cpu_util | double | YES | | | | Float64 |
+----------+--------+------+-----+---------+-------+---------------+
DROP TABLE system_metrics;
Affected Rows: 0