How many tables in a database?
The number of tables in a relational database is a good measure of the complexity of a database, so it is a simple way to get to know any database.
In this recipe, we will show you how to compute the number of tables.
How to do it…
From any interface, type the following SQL command:
SELECT count(*) FROM information_schema.tables WHERE table_schema NOT IN ('information_schema', 'pg_catalog');
You can also look at the list of tables directly and judge whether the list is a small or large number.
In psql, you can see your own tables using the following command:
postgres@ebony:~/8.3/main$ psql -c "\d" List of relations Schema | Name | Type | Owner --------+----------+-------+---------- public | accounts | table | postgres public | branches | table | postgres
In pgAdmin3, you can see the tables in the tree view on the left-hand side, as shown in the following screenshot:
![](https://static.packt-cdn.com/products/9781849519069/graphics/9069OS_02_01.jpg)
How it works…
PostgreSQL stores information about the database in catalog tables...