From 250dc423655496182f7fdfe415f225ea916fd5a4 Mon Sep 17 00:00:00 2001 From: Div Arora Date: Wed, 1 Sep 2021 07:18:10 +0800 Subject: [PATCH] chore: add a note about global timeout --- web/docs/guides/database/resource-management.mdx | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/web/docs/guides/database/resource-management.mdx b/web/docs/guides/database/resource-management.mdx index 840a828967d..a919f5ead06 100644 --- a/web/docs/guides/database/resource-management.mdx +++ b/web/docs/guides/database/resource-management.mdx @@ -6,7 +6,7 @@ description: Resource management and optimization ## Statement Timeouts -By default, Supabase limits the maximum statement execution time to _3 seconds_ for users accessing the API using the anon key, and _8 seconds_ for authenticated users. This serves as a backstop against resource exhaustion due to either poorly written queries, or abusive usage. +By default, Supabase limits the maximum statement execution time to _3 seconds_ for users accessing the API using the anon key, and _8 seconds_ for authenticated users. Additionally, all users are subject to a global limit of _2 minutes_. This serves as a backstop against resource exhaustion due to either poorly written queries, or abusive usage. The timeout values were picked as a reasonable default for the majority of use-cases, but can be modified using the [ALTER ROLE](https://www.postgresql.org/docs/13/sql-alterrole.html) statement: @@ -14,6 +14,12 @@ The timeout values were picked as a reasonable default for the majority of use-c alter role authenticated set statement_timeout = '15s'; ``` +You can also update the statement timeout for a session: + +```sql +set statement_timeout to 60000; -- 1 minute in milliseconds +``` + ## Statement Optimization All Supabase projects come with the [pg_stat_statements](https://www.postgresql.org/docs/13/pgstatstatements.html) extension installed, which tracks planning and execution statistics for all statements executed against it. These statistics can be used in order to diagnose the performance of your project.