Hologres
· 约 1 分钟阅读
Hologres 与 PostgreSQL 有很多类似的地方。
获取数据库中的所有视图
SELECT *FROM INFORMATION_SCHEMA.viewsWHERE table_schema NOT IN ('pg_catalog', 'information_schema', 'pg_catalog')结果:
| table_catalog | table_schema | table_name | view_definition | check_option | is_updatable | is_insertable_into | is_trigger_updatable | is_trigger_deletable | is_trigger_insertable_into |
|---|---|---|---|---|---|---|---|---|---|
| … | … | … | … | … | … | … | … | … | … |
获取每个表的大小
SELECT table_schema || '.' || table_name AS table_full_name, table_schema, table_name, pg_size_pretty(pg_relation_size(quote_ident(table_schema) || '.' || quote_ident(table_name))) AS table_size, pg_relation_size(quote_ident(table_schema) || '.' || quote_ident(table_name)) AS order_sizeFROM information_schema.tablesWHERE table_schema NOT IN ('pg_catalog', 'information_schema', 'hologres')ORDER BY order_size DESC;