docs: Add datconnlimit resolution to troubleshooting guide (#43855)

## I have read the
[CONTRIBUTING.md](https://github.com/supabase/supabase/blob/master/CONTRIBUTING.md)
file.

YES

## What kind of change does this PR introduce?

Docs update based on
https://www.postgresql.org/docs/current/catalog-pg-database.html

## What is the current behavior?

Please link any relevant issues here.

## What is the new behavior?

Feel free to include screenshots if it includes visual changes.

## Additional context

Add any other context or screenshots.


<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->
## Summary by CodeRabbit

* **Documentation**
* Added a troubleshooting guide for the PostgreSQL "too many
connections" error.
* Describes how to diagnose connection-limit settings and detect
non-default configurations.
* Offers recommended recovery steps to restore default connection limits
and safely recover affected databases, with links to relevant PostgreSQL
documentation.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->

---------

Co-authored-by: Chris Chinchilla <chris.ward@supabase.io>
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: Chris Chinchilla <chris@chrischinchilla.com>
This commit is contained in:
karlo
2026-05-05 17:09:11 +08:00
committed by GitHub
parent b01941275b
commit 9e3efd1b78
@@ -0,0 +1,27 @@
---
title = "Database: \"Error: too many connections for database \"postgres\"\""
topics = [ "database" ]
keywords = []
---
When getting an error where your connections are overwhelmed `Error: too many connections for database "postgres"`
## Why this occurs
This issue occurs when `datconnlimit` gets modified. The default value for `datconnlimit` is -1.
https://www.postgresql.org/docs/current/catalog-pg-database.html
## To check and resolve
1. **Check the value for `datconnlimit` using the query below**
```bash
select datconnlimit from pg_database where datname='postgres';
```
- If the value you see is 0 or any other value other than -1, proceed with the next step.
2. **Update `datconnlimit` to DEFAULT**
```bash
ALTER DATABASE postgres CONNECTION LIMIT DEFAULT;
```