How to List Tables in PostgreSQL
Last updated August 26, 2026 · By the SaturnSQL team
In psql, \dt lists tables in the search path. From SQL, query pg_tables or information_schema.tables; pg_total_relation_size adds on-disk sizes.
psql
\dt is a psql meta-command rather than SQL, so it only works in psql and fails in any other client. It lists tables in the current search_path; add a schema pattern such as archive.* to look elsewhere, or \dt *.* for everything. \dt+ adds size and description columns.
\dt
\dt archive.*Plain SQL (works from any client)
pg_tables works from any client, including GUI tools and application code. The quote_ident call matters: without it, a table name that is mixed case or contains a special character breaks the size lookup. Change schemaname to target a different schema, or drop the filter and add it to the SELECT to cover the whole database.
SELECT tablename,
pg_size_pretty(pg_total_relation_size(quote_ident(tablename))) AS size
FROM pg_tables
WHERE schemaname = 'public'
ORDER BY pg_total_relation_size(quote_ident(tablename)) DESC;pg_tables, information_schema and \dt list different things
pg_tables shows every table in the cluster's current database whether or not you can read it. information_schema.tables shows only what your role has some privilege on, which is why it can come back shorter, and it includes views alongside tables unless you filter on table_type. pg_class is the one to reach for when you also want row estimates or sizes without scanning anything.
SELECT relname,
reltuples::bigint AS estimated_rows,
pg_size_pretty(pg_total_relation_size(oid)) AS size
FROM pg_class
WHERE relkind = 'r' AND relnamespace = 'public'::regnamespace
ORDER BY pg_total_relation_size(oid) DESC;Common errors
Did not find any relations.
psql's \dt only lists tables in the schemas on your search_path. If the tables live in a schema that is not there, the database looks empty even though it is not.
List every schema with \dt *.*, or query pg_tables directly, which ignores search_path.
\dt *.*
SELECT schemaname, tablename
FROM pg_tables
WHERE schemaname NOT IN ('pg_catalog', 'information_schema')
ORDER BY 1, 2;Run this in SaturnSQL
SaturnSQL is a browser-based SQL editor for teams: shared query library, schema-aware autocomplete, and scheduled exports to Google Sheets and Slack.
Try it free