How to Show Tables in PostgreSQL: A Simple Guide
Robert Cooper
Robert Cooper Senior Engineer at Basedash
· January 31, 2025
Robert Cooper
Robert Cooper Senior Engineer at Basedash
· January 31, 2025
Understanding how to display all tables within a PostgreSQL database is crucial for database management and data analysis. By mastering this, you ensure efficient navigation and a deeper understanding of your database’s structure. This guide will lead you through a straightforward approach to view all existing tables within a specific PostgreSQL database, benefiting database administrators and developers who need to reference table structures or plan queries.
Log in to your PostgreSQL database using the psql command line tool:
psql -U username -d database_name
Replace username with your PostgreSQL username and database_name with the name of the database you intend to inspect.
Once logged in, execute the \\dt command to list all tables in the current database:
\\dt
This command reveals a list of all tables in the database, showing details such as the schema name, table name, table type, and owner.
To target tables from a specific schema, append the schema name to the \\dt command:
\\dt schema_name.*
Substitute schema_name with your actual schema name. This lists all tables within that particular schema.
For a detailed view that includes additional information about each table, employ the \\dt+ command:
\\dt+
This extended information encompasses descriptions, table sizes, and indexes associated with each table.
By familiarizing yourself with these commands, you significantly improve your ability to navigate and manage databases effectively. This knowledge is fundamental whether you’re conducting an audit of an existing database or planning new database structures, making quick listing and assessment of tables an indispensable skill.
Written by
Senior Engineer at Basedash
Robert Cooper is a senior engineer at Basedash who builds full-stack product systems across SQL data infrastructure, APIs, and frontend architecture. His work focuses on application performance, developer velocity, and reliable self-hosted workflows that make data operations easier for teams at scale.
Basedash lets you build charts, dashboards, and reports in seconds using all your data.