Skip to content

The Postgres development platform. Supabase gives you a dedicated Postgres database to build your web, mobile, and AI applications.

chore: add section on using pg_stat_activity

Div Arora20eedfe36ae3
diff --git a/apps/reference/docs/guides/platform/performance.mdx b/apps/reference/docs/guides/platform/performance.mdx
index 300d70674cd..e747df44863 100644
--- a/apps/reference/docs/guides/platform/performance.mdx
+++ b/apps/reference/docs/guides/platform/performance.mdx
@@ -30,7 +30,19 @@ $ psql -U postgres -h ...
FATAL: remaining connection slots are reserved for non-replication superuser connections
```
-In such a scenario, you can consider either upgrading to a larger compute add-on, or alternatively, by manually configuring the database for a higher number of connections.
+In such a scenario, you can consider:
+
+- [upgrading to a larger compute add-on](https://app.supabase.com/project/_/settings/billing)
+- configuring your clients to use fewer connections
+- manually configuring the database for a higher number of connections
+
+### Configuring clients to use fewer connections
+
+You can use the [pg_stat_activity](https://www.postgresql.org/docs/current/monitoring-stats.html#MONITORING-PG-STAT-ACTIVITY-VIEW) view to debug which clients are holding open connections on your DB.
+
+Depending on the clients involved, you might be able to configure them to work with fewer connections (e.g. by imposing a limit on the maximum number of connections they're allowed to use), or shift specific workloads to connect via [pgbouncer](/docs/guides/database/connecting-to-postgres#connection-pool) instead. Transient workflows, which can quickly scale up and down in response to traffic (e.g. serverless functions), can especially benefit from using a connection pooler rather than connecting to the DB directly.
+
+### Allowing higher number of connections
You can configure Postgres by executing the following statement, followed by a server restart: