har*_*rry 34 database postgresql postgresql-8.4
有什么方法可以获得Postgresql数据库中的表总数吗?我正在使用的postgresql版本是PostgreSQL 8.4.14.
a_h*_*ame 45
select count(*)
from information_schema.tables;
或者,如果要查找仅针对特定架构的表数:
select count(*)
from information_schema.tables
where table_schema = 'public';
suf*_*leR 15
只需尝试在pg_stat ... tables或information_schema中搜索,您就可以找到有关数据库的非常有用的信息.
例:
select * from  pg_stat_user_tables ;
select count(*) from  pg_stat_user_tables ; 
select * from  pg_stat_all_tables ;