Search code examples
databasepostgresqlpostgresql-8.4

How to get the total number of tables in postgresql?


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.


Solution

  • 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';