pg_catalog.pg_namespace来查看当前数据库中全部的Schema
select oid,* from pg_catalog.pg_namespace;
创建schema
create schema gs_dqms
显示当前使用的schema
SHOW search_path;
切换当前schema
SET search_path TO gs_dqms;
查看Schema---- dgp_sd下所有表的大小:
select relname, pg_size_pretty(pg_total_relation_size(relid)) from pg_stat_user_tables where schemaname='gs_dqms' order by pg_relation_size (relid) desc;
查看所有数据库的大小
select pg_database.datname, pg_size_pretty(pg_database_size(pg_database.datname)) AS size from pg_database;
查询数据库中的所有表:(指定schema)
select * from information_schema.tables
select * from information_schema.columns where table_schema='gs_dqms';
select * from information_schema.tables where table_schema='gs_dqms';