Avoiding timeouts in long running queries
Last edited: 1/17/2025
This page covers long-running queries via the Dashboard or external interfaces. For Supabase Client API timeout errors, check this guide instead.
Certain queries, like indexing a table or changing a column's data type, are inherently time-consuming. The Dashboard's SQL Editor has a 1-minute timeout limit.
To execute long-running queries, follow the below steps.
Install an external SQL client
The guide focuses on psql but you can use any Postgres client.
Some other options include:
You can install PSQL in macOS and Windows by following these links and instructions. For Linux (Debian) you can run the following:
_10sudo apt-get update_10sudo apt-get install postgresql-client
Once installed, you can find your PSQL string in the Database Settings. Please make sure if you are using the pooler connection that it is in session mode (port 5432).
If you are working in an IPv6 environment or have the IPv4 Add-On, it is preferable to use the direct connection.
Increase the query timeout
Then you can increase the query timeout solely for your session:
Long timeout
_10set statement_timeout = '120min';
Disable timeout
_10set statement_timeout = '0';
If your task is particularly long, you can may want to consider boosting your computing power temporarily. Compute size on Supabase is charged by the hour, so you can increase it for an hour or two, complete your task faster, then scale it back afterward.
If you want to temporarily upgrade, you can find the add-ons for your project in your Dashboard's Add-Ons Settings.