Table of Contents [expand]
Last updated February 24, 2026
If your Heroku Postgres database exceeds your plan allotment for storage capacity, you receive a warning email with directions on how to fix the issue. In some cases, we set an enforcement date when access to your database is disabled until the add-on’s data size is back within plan limits. Take action by upgrading your database plan or deleting data to avoid restricted access.
Over Plan Capacity Statuses
To see the status and current data size of your Heroku Postgres database, run the heroku pg:info command. If your database is over capacity, under Status you see: Over Plan Capacity: Action Required or Over Plan Capacity: Access Restricted.
The Heroku Dashboard also shows the status and data storage utilization of your Heroku Postgres databases.
Action Required
Your database is over its plan capacity, and you must upgrade its plan or delete unnecessary data to bring your data size within plan limits before the enforcement date. You can find the enforcement date in your email or in your application logs.
Access Restricted
Your database is over plan capacity beyond the enforcement date and we restricted database access. Restricted access means:
- You’re allowed a single database connection through a restricted database credential.
- Your restricted credential only has
READ,DELETE, andTRUNCATEdatabase privileges.
To regain full access, you can upgrade your database plan or delete data by connecting to the database with the restricted credential.
If your database has been over capacity for more than 30 days, Heroku attempts to reduce your data usage by running VACUUM FULL on your database to remove dead rows and reclaim the disk space used by bloat.
Steps to Resolve
Check Your Data Usage
To check your Postgres database, use heroku pg:info. The output shows your database plan and data size so you can decide whether to upgrade your plan or remove data.
$ heroku pg:info HEROKU_POSTGRESQL_COBALT -a example-app
=== HEROKU_POSTGRESQL_COBALT_URL
Plan: Standard 0
Status: Over Capacity: Action Required
Data Size: 144.6 GB
The Heroku Dashboard also shows the data storage utilization and plan of your Heroku Postgres databases.
Upgrade Your Plan
To get more storage, you can upgrade your Heroku Postgres plan. If you do upgrade, you avoid data loss and minimize downtime. You can downgrade your database plan at any time if your data storage reduces.
The simplest way to upgrade is to use the addons:upgrade command, specifying your add-on and the target plan:
$ heroku addons:upgrade HEROKU_POSTGRESQL_COBALT_URL heroku-postgresql:standard-2 -a example-app
To learn about more upgrade tools, see Changing the Plan or Infrastructure of a Heroku Postgres Database..
Delete Your Data
When database access is restricted, you’re allowed a single database connection through a new, restricted database credential. If your Heroku dynos automatically attempt to connect to your database, they might consume the single connection slot available.To connect to your database, consider shutting down any dynos before directly connecting with the restricted credentials. Contact Heroku Support if you still can’t connect to your database.
To return within your plan limits, you can delete data instead of upgrading to a larger plan.
Test Deletion with a Fork
Before you delete data from your database, create a fork so that you can experiment before you act on your data.
After you create a fork, you can follow these steps to delete your data. These examples use pg:psql to modify the database directly with SQL queries.
Delete Data
To delete data, use a condition to remove specific rows from a table, or truncate a table to delete all its records.
$ heroku pg:psql HEROKU_POSTGRESQL_COBALT -a example-app
# Delete records older than 30 days
example-app::HEROKU_POSTGRESQL_COBALT=> DELETE FROM logs WHERE created_at < (now() - '30 days'::interval);
The restricted credential doesn’t have DROP privileges to delete tables. To remove all data from a table of noncritical data, you can use TRUNCATE:
heroku pg:psql HEROKU_POSTGRESQL_COBALT -a example-app
example-app::HEROKU_POSTGRESQL_COBALT=> TRUNCATE TABLE logs;
Re-Index
Re-index tables or specific indexes to reclaim space from bloated indexes after deleting or truncating data:
example-app::HEROKU_POSTGRESQL_COBALT=> REINDEX TABLE CONCURRENTLY logs;
Vacuum
Running VACUUM FULL on a table takes an AccessExclusive lock on the table and it blocks other queries from reading it while it runs.
Your Postgres plan is measured by disk usage. Postgres doesn’t perform deletes on disk, but marks space that can be reused. To release unused disk space, run VACUUM FULL. When you test this on your fork, note how long the VACUUM FULL takes so you can assess the production impact.
example-app::HEROKU_POSTGRESQL_COBALT=> VACUUM FULL;
See Managing VACUUM on Heroku Postgres for more info on types of VACUUM operations and how they work.
Performing Deletion on Your Live Database
Put your app in maintenance mode while you use VACUUM FULL so users can’t access it mid-operation. If your database access is restricted, it’s possible that your application is inoperable already as your application wouldn’t be able to open the necessary connections against your database, but use maintenance mode to be safe.
Use Log Entries to Track Plan Capacity
Heroku Postgres emits log messages to Logplex when your service goes over capacity. The log messages are available via the CLI or via logging add-ons.
Log entries follow the standard log format.
If your database is over capacity, Heroku Postgres emits a Pending Enforcement warning log line:
$ heroku logs -a example-app
2026-07-20T23:14:08.000000+00:00 app[heroku-postgres]: source=HEROKU_POSTGRESQL_GREEN_URL addon=postgresql-octagonal-423563 sample#restricted=false sample#database-capacity-used-bytes=107889578475 sample#database-capacity-used-percentage=157.00 sample#database-capacity-bytes=68719476736 sample#enforcement-date=2026-08-04 00:00:00 +0000 message=Pending Enforcement: Upgrade or delete data by 2026-08-04 00:00:00 +0000 or lose database access
If your enforcement date has passed, Heroku Postgres emits an Access Restricted warning log line:
$ heroku logs -a example-app
2026-08-28T23:14:08.000000+00:00 app[heroku-postgres]: source=HEROKU_POSTGRESQL_GREEN_URL addon=postgresql-octagonal-423563 sample#restricted=true sample#database-capacity-used-bytes=107889578475 sample#database-capacity-used-percentage=157.00 sample#database-capacity-bytes=68719476736 message=Access Restricted: Upgrade or delete data to restore access