
SQL
Postgres
- Estimate row count of all table in a schema
SELECT relname AS table_name,
reltuples::BIGINT AS estimated_row_count
FROM pg_class
WHERE relkind = 'r'
AND relnamespace IN (
SELECT oid FROM pg_namespace WHERE nspname = 'schema_name'
)
ORDER BY estimated_row_count DESC;