Files
greptimedb/tests/cases/standalone/common/information_schema/region_statistics.result
dennis zhuang 191755fc42 fix: data_length, index_length, table_rows in tables (#4927)
* fix: data_length, index_length, table_rows in tables

* feat: table stats only works for mito engine currently

* fix: tests

* fix: typo

* chore: log error when region_stats fails
2024-11-04 07:44:13 +00:00

47 lines
2.1 KiB
Plaintext

USE public;
Affected Rows: 0
CREATE TABLE test (
a int primary key,
b string,
ts timestamp time index,
) PARTITION ON COLUMNS (a) (
a < 10,
a >= 10 AND a < 20,
a >= 20,
);
Affected Rows: 0
INSERT INTO test VALUES
(1, 'a', 1),
(11, 'b', 11),
(21, 'c', 21);
Affected Rows: 3
-- SQLNESS SLEEP 3s
SELECT SUM(region_rows), SUM(disk_size), SUM(sst_size), SUM(index_size)
FROM INFORMATION_SCHEMA.REGION_STATISTICS WHERE table_id
IN (SELECT TABLE_ID FROM INFORMATION_SCHEMA.TABLES WHERE table_name = 'test' and table_schema = 'public');
+-------------------------------------------------------+-----------------------------------------------------+----------------------------------------------------+------------------------------------------------------+
| SUM(information_schema.region_statistics.region_rows) | SUM(information_schema.region_statistics.disk_size) | SUM(information_schema.region_statistics.sst_size) | SUM(information_schema.region_statistics.index_size) |
+-------------------------------------------------------+-----------------------------------------------------+----------------------------------------------------+------------------------------------------------------+
| 3 | 2145 | 0 | 0 |
+-------------------------------------------------------+-----------------------------------------------------+----------------------------------------------------+------------------------------------------------------+
SELECT data_length, index_length, avg_row_length, table_rows FROM INFORMATION_SCHEMA.TABLES WHERE table_name = 'test';
+-------------+--------------+----------------+------------+
| data_length | index_length | avg_row_length | table_rows |
+-------------+--------------+----------------+------------+
| 0 | 0 | 26 | 3 |
+-------------+--------------+----------------+------------+
DROP TABLE test;
Affected Rows: 0