Files
greptimedb/tests/cases/standalone/common/information_schema/region_statistics.sql
dennis zhuang dcc08f6b3e feat: adds the number of rows and index files size to region_statistics table (#4909)
* feat: adds index size to region statistics

* feat: adds the number of rows for region statistics

* test: adds sqlness test for region_statistics

* fix: test
2024-10-30 11:12:58 +00:00

26 lines
640 B
SQL

USE public;
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,
);
INSERT INTO test VALUES
(1, 'a', 1),
(11, 'b', 11),
(21, 'c', 21);
-- SQLNESS SLEEP 11s
-- FIXME(dennis): we need to wait the datanode reporting stats info to metasrv.
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');
DROP TABLE test;