问题
Is there any way by which I can get the total number of tables in a Postgresql database? The postgresql version I'm using is PostgreSQL 8.4.14.
回答1:
select count(*)
from information_schema.tables;
Or if you want to find the number of tables only for a specific schema:
select count(*)
from information_schema.tables
where table_schema = 'public';
回答2:
Just try to search in pg_stat... tables or information_schema you can find there very useful informations about your database.
Example:
select * from pg_stat_user_tables ;
select count(*) from pg_stat_user_tables ;
select * from pg_stat_all_tables ;
回答3:
select Count(*) from sys.tables
来源:https://stackoverflow.com/questions/13931494/how-to-get-the-total-number-of-tables-in-postgresql