Skip to main content

Disk space usage

Database disk space usage refers to the monthly average disk usage, as reported by Postgres. This metric is reported in your project's billing page and is updated daily.

For an instantaneous live view of the DB disk space being used by your project, you can execute in Postgres:

SELECT SUM(pg_database_size(pg_database.datname)) / (1024 * 1024) as db_size_mb FROM pg_database;

This value is also reported in the database settings page.

Vacuum operations

Postgres does not immediately reclaim the physical space used by dead tuples (i.e., deleted rows) in the DB. Instead, they are internally marked as removed until a vacuum operation is executed. As a result, deleting data from your DB may not immediately reduce the reported disk usage.

note

Vacuum operations can temporarily increase resource utilization, which can adversely impact the observed performance of your project until the maintenance is completed.

Supabase projects have automatic vacuuming enabled, which ensures that these operations are performed regularly to keep the database healthy and performant. However, it can be necessary to either fine-tune the autovacuum parameters, or manually initiate vacuum operations. For example, running a manual vacuum after deleting large amounts of data from your DB could help reduce the reported disk usage by Postgres.