Skip to content

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

1.6 KB
Raw Blame
---
title = "Error: Failed to run sql query: Connection terminated due to connection timeout"
topics = [ "database", "studio" ]
database_id = "7529ca12-114b-485c-9b64-bca3b2dc744b"
[[errors]]
http_status_code = 500
message = "Error: Failed to run sql query: Connection terminated due to connection timeout"
---

![Failed to run sql query: Connection terminated due to connection timeout](/docs/img/troubleshooting/failed-to-run-sql-query-connection-terminated-due-to-connection-timeout.jpg)

This error typically happens when the database is overloaded and causing an outage. As the database does not respond in a timely manner there can be a variety of symptoms such as tables not loading, error messages related to retrieving data and the dashboard seems to be unresponsive.

- Check your database health in [Database reports](/dashboard/project/_/observability/database).
- If needed, increase resources in [Infrastructure](/dashboard/project/_/settings/infrastructure).
- Alternatively, you can restart the database in [Project Settings](/dashboard/project/_/settings/general) but this may be only a temporary fix if the project is undersized / unoptimized.

Review the appropriate guides based on your scenario:

- [High CPU usage](/kb/troubleshooting/high-cpu-usage)
- [High RAM usage](/kb/troubleshooting/exhaust-ram)
- [High Swap usage](/kb/troubleshooting/exhaust-swap)
- [High Disk I/O](/kb/troubleshooting/exhaust-disk-io)
- [Query optimization](/docs/guides/database/query-optimization)

You can also set up alerts using a [Prometheus endpoint / Grafana charts](/docs/guides/observability/metrics) to monitor vital resources.