Lists all user and system tables in an Amazon Redshift database using catalog or INFORMATION_SCHEMA views.
Use either the system catalog (pg_catalog.pg_tables
) or the ANSI-standard information_schema.tables
view. Both return one row per table and support schema filtering.
Run SELECT * FROM pg_catalog.pg_tables WHERE schemaname NOT IN ('pg_catalog','information_schema');
. This hides system objects and surfaces only user-created tables.
Filter the view by schemaname
(catalog) or table_schema
(information schema):SELECT tablename FROM pg_catalog.pg_tables WHERE schemaname = 'public';
Join pg_tables
with SVV_TABLE_INFO
to retrieve row_count
, size
, and sort/compression stats in one query. This is useful for capacity planning.
Information schema views are portable across databases, easing migration from PostgreSQL, MySQL, or SQL Server. They also respect user privileges, avoiding permission errors.
✔ Use LIMIT
during exploration to avoid overwhelming result sets.
✔ Exclude system schemas in production scripts.
✔ Grant SELECT
on catalog views only to trusted roles to prevent metadata leakage.
• Querying without schema filter returns thousands of internal tables, slowing clients.
• Using pg_table_def
instead of pg_tables
when you only need the table name wastes resources because pg_table_def
expands every column.
No direct command exists. Use SELECT queries on pg_catalog or information_schema instead.
Only when you remove the table_type filter. Set table_type IN ('BASE TABLE','VIEW')
to include them.
Yes. Join pg_tables with pg_class and filter by relcreationtime or check the SVV_TABLE_INFO.last_update column.