Current database size
This returns raw bytes for calculations and a human-readable value for display.
SELECT
current_database() AS database_name,
pg_database_size(current_database()) AS size_bytes,
pg_size_pretty(pg_database_size(current_database())) AS size_pretty;Largest tables and materialized views
pg_total_relation_size includes the relation, its indexes, and TOAST data. The catalog filter omits PostgreSQL system schemas.
SELECT
n.nspname AS schema_name,
c.relname AS relation_name,
pg_total_relation_size(c.oid) AS total_bytes,
pg_size_pretty(pg_total_relation_size(c.oid)) AS total_size
FROM pg_class AS c
JOIN pg_namespace AS n ON n.oid = c.relnamespace
WHERE c.relkind IN ('r', 'm')
AND n.nspname NOT IN ('pg_catalog', 'information_schema')
AND n.nspname !~ '^pg_toast'
ORDER BY total_bytes DESC
LIMIT 25;Database size is not provider disk size
Logical database size does not necessarily include WAL, provider system files, backups, history storage, object storage, or provisioned disk headroom. Supabase explicitly distinguishes database size from disk size; Neon storage and billing categories also have provider-specific definitions.
Operational cautions
- Sizes can change while a busy database is being measured.
- Catalog visibility and size-function permissions depend on the role and PostgreSQL version.
- Do not run broad diagnostics more frequently than needed on production systems.
- Use the same query and unit when comparing observations over time.
Definitions and sources
Provider and PostgreSQL statements last reviewed August 27, 2026. Pricing consoles and invoices remain authoritative.
Related database resources
PostgreSQL index size guide
Measure table and index footprint without reading application rows.
Open resourceDatabase growth calculator
Measure growth pace and a transparent threshold projection.
Open resourceNeon vs Supabase
Compare current platform and usage-model differences without a false winner.
Open resource