Runtime Information
The INFORMATION_SCHEMA
database provides access to system metadata, such as the name of a database or table, the data type of a column, etc.
- Find the topology information of the cluster though CLUSTER_INFO table.
- Find the table regions distribution though PARTITIONS and REGION_PEERS tables.
For example, find all the region id of a table:
SELECT greptime_partition_id FROM PARTITIONS WHERE table_name = 'monitor'
Find the distribution of all regions in a table:
SELECT b.peer_id as datanode_id,
a.greptime_partition_id as region_id
FROM information_schema.partitions a LEFT JOIN information_schema.region_peers b
ON a.greptime_partition_id = b.region_id
WHERE a.table_name='monitor'
ORDER BY datanode_id ASC
For more information about the INFORMATION_SCHEMA
database,
Please read the reference.