Home

Database size

Database size refers to the monthly average storage usage, as reported by Postgres. This metric is reported in your project's billing usage and is updated daily. As you read this document we will refer to "database size" and "disk size":

  • "Database size" is the total size of used storage from your database.
  • "Disk size" describes the size of the underlying available storage.

Database space management#

Database size#

This SQL query will show the current size of your Postgres database:

select
  sum(pg_database_size(pg_database.datname)) / (1024 * 1024) as db_size_mb
from pg_database;

This value is reported in the database settings page.

Database Space is consumed primarily by your data, indexes, and materialized views. You can reduce your disk size by removing any of these and running a Vacuum operation.

note

Depending on your billing tier, your database can go into read-only mode which can prevent you inserting and deleting data. There are instructions for managing read-only mode in the Disk Management section.

Vacuum operations#

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

note

Vacuum operations can temporarily increase resource utilization, which may 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. It is possible to fine-tune the autovacuum parameters, or manually initiate vacuum operations. Running a manual vacuum after deleting large amounts of data from your DB could help reduce the database size reported by Postgres.

Preoccupied Space#

New Supabase projects have a database size of ~40-60mb. This space includes pre-installed extensions, schemas, and default Postgres data. Additional database size is used when installing extensions, even if those extensions are inactive.

Disk management#

Supabase uses network-attached storage to balance performance with scalability. The behavior of your disk depends on your billing tier.

Pro and Enterprise projects have auto-scaling Disk Storage.

Disk storage expands automatically when the database reaches 90% of the disk size. The disk is expanded to be 50% larger (e.g., 8GB -> 12GB). Auto-scaling can only take place once every 6 hours. If within those 6 hours you reach 95% of the disk space, your project will enter read-only mode.

caution

If you intend to import a lot of data into your database which requires multiple disk expansions then reach out to our team. For example, uploading more than 1.5x the current size of your database storage will put your database into read-only mode.

The maximum Disk Size for Pro Tier is 1024TB. If you need more than this, contact us to learn more about the Enterprise plan.

Free Tier Behavior#

Free Tier projects enter read-only mode when you exceed the 500mb limit. Once in read-only mode, you have several options:

Read-only mode#

In some cases Supabase may put your database into read-only mode to prevent your database from exceeding the billing or disk limitations.

In read-only mode, clients will encounter errors such as cannot execute INSERT in a read-only transaction. Regular operation (read-write mode) is automatically re-enabled once usage is below 95% of the disk size,

Disabling read-only mode#

You can manually override read-only mode to reduce disk size. To do this, run the following in the SQL Editor:

SET
  default_transaction_read_only = 'off';

This allows you to delete data from within the session. After deleting data, you should run a vacuum to reclaim as much space as possible.

Need some help?

Not to worry, our specialist engineers are here to help. Submit a support ticket through the Dashboard.