








Last updated May 18, 2026
Heroku Postgres Advanced is in limited general availability. To start creating and using Advanced databases, open a ticket with Heroku Support to request access. Subscribe to our changelog to stay informed of when Heroku Postgres Advanced is generally available.
You can set quotas and thresholds on Heroku Postgres Advanced to prevent going over certain database limits. This article describes the types of quotas you can set, types of actions you can trigger, and how to set and view quotas.
You can only set quotas and thresholds on Postgres Advanced databases. For information about storage capacity on non-Advanced plans, see Heroku Postgres Over Plan Capacity.
All Advanced databases include 100 GB of storage at no cost and you can use up to 100 TB of storage. Heroku charges for the additional storage you use over your included storage amount. To avoid going over the storage limit and incurring extra costs, configure quota thresholds on your storage usage.
You can set a warning threshold and a critical threshold in GB:
| Threshold | Description |
|---|---|
warning |
Get an email notification when exceeding the configured threshold and get alerts in the CLI. |
critical |
Get the configured enforcement action when exceeding the threshold. |
You can select an enforcement action if you reach your critical threshold limit:
| Enforcement Action | Description |
|---|---|
restrict |
We send an email and give a 7 day grace period for you to bring the database below limits. After 7 days if the database is still exceeding the threshold, we apply the restrict action. After the grace period, we revoke |
notify |
We send an email notifying your database has exceeded its critical threshold. The database storage can continue increasing and incurs costs if it exceeds the 100 GB included storage amount. |
none |
We don’t send a notification or restrict database access. The database storage can continue increasing and incurs costs if it exceeds the 100 GB included storage amount. |
To configure storage thresholds and an enforcement action on your database, use the heroku data:pg:quotas:update command. This example sets a warning threshold of 80 GB, a critical threshold of 95 GB, and an enforcement action of Notify if storage usage is over 95 GB.
$ heroku data:pg:quotas:update DATABASE -a example-app --type storage --warning 80 --critical 90 --enforcement-action notify
Updating storage quota on ⛁ DATABASE... done
=== Storage
Warning: 80.00 GB
Critical: 95.00 GB
Enforcement Action: Notify
Enforcement: 10.07 GB / 95.00 GB (10.60 %) (Within configured quotas)
You can also view your quotas with the data:pg:quotas command:
$ heroku data:pg:quotas DATABASE -a example-app
=== Storage
Warning: 80.00 GB
Critical: 90.00 GB
Enforcement Action: Notify
Enforcement: 10.07 GB /95.00 GB (10.60 %) (Within configured quotas)
If you exceed your configured thresholds and want to either stop receiving notifications, avoid disruption to your service if you’re in the grace period, or restore full access after having your database restricted, you can either:
If you set an enforcement action of restrict, we restrict database access after the grace period and you can’t use DROP TABLE or DROP INDEX to reduce your storage usage. Use DELETE and TRUNCATE instead.
You can delete data by removing unnecessary data, old logs, or unused records in a psql session.
Use DELETE to delete rows in a table. For example, to delete records older than 30 days in a logs table:
$ heroku pg:psql HEROKU_POSTGRESQL_COBALT -a example-app
example-app::HEROKU_POSTGRESQL_COBALT=> DELETE FROM logs WHERE created_at < (now() - '30 days'::interval);
Use DROP TABLE to remove a table. For example, to drop the orders and transactions tables:
$ heroku data:pg:psql HEROKU_POSTGRESQL_COBALT -a example-app
example-app::HEROKU_POSTGRESQL_COBALT=> DROP TABLE orders, transactions;
Use TRUNCATE to delete all rows from a table. For example, to delete all rows from the logs table:
$ heroku data:pg:psql HEROKU_POSTGRESQL_COBALT -a example-app
example-app::HEROKU_POSTGRESQL_COBALT=> TRUNCATE TABLE logs;
You can optimize storage on your database by dropping unused indexes or archiving historical records in a psql session.
Use DROP INDEX to remove an index. For example, to drop an index named user_email_idx:
$ heroku data:pg:psql HEROKU_POSTGRESQL_COBALT -a example-app
example-app::HEROKU_POSTGRESQL_COBALT=> DROP INDEX CONCURRENTLY user_email_idx;
You can reconfigure your storage thresholds to get out of the exceeded range.
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。