How to get the total number of tables in postgresql?
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';
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 ;
If you want to get just the number of tables (without views) then:
select count(*) from information_schema.tables where table_type = 'BASE TABLE';
Or you can also filter by schema name by adding the where condition like:
table_schema = 'public'