一、普通表的查询方法
select count(*) from "realtime_meta"
select relname,reltuples from pg_class where relname = 'realtime_meta'
二、时序数据库超表的查询方法
select SUM(pg_class.reltuples)
FROM pg_class where relname in (
SELECT chunk_name
FROM timescaledb_information.chunks
WHERE hypertable_name = 'realtime_data'
)
三、如果要查询时序数据库的总和
可行思路:
- 先查询timescaledb_information.chunks表,过滤时间段的chunk;
- 再到pg_class中查询涉及chunk的总和;