Avoiding timeouts in long running queries #21133
TheOtherBrian1
announced in
Troubleshooting
Replies: 1 comment 2 replies
-
Hi, Is there any possibility to set statement_timeout for some specific function? I've tried to do I understand that there is possibility to set different timeouts for each role and I can set timeout for service role, but sometimes service role can be used for specific queries to provide data for public users and I would want to allow bigger timeout only for specific tasks. |
Beta Was this translation helpful? Give feedback.
2 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Some queries, such as indexing a table or changing a column's data type are unavoidably time consuming. When you must execute long-running queries, there are a few steps that should be taken. The Dashboard's SQL Editor has an internal time limit of ~1 minute for queries, so it is necessary to execute your code through an external interface, such as PSQL.
You can install PSQL in macOS and Windows by following these links and instructions. For Linux (Debian) you can run the following:
Once installed, you can find your PSQL string from the Database Settings. Please make sure if you are using the pooler connection that it is in session mode (port 5432).
Then you can increase the query timeout for your session:
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.
Here is a list of compute add-ons. If you want to temporarily upgrade, you can find the add-ons for your project in your Dashboard's Add-Ons Settings.
Beta Was this translation helpful? Give feedback.
All reactions