Updating the default congfiguration for your Postgres database.
Postgres provides a set of sensible defaults for you database size. In some cases, these defaults can be updated. We do not recommend changing these defaults unless you know what you're doing.
By default, Supabase limits the maximum statement execution time to 8 seconds for users accessing the API. 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.
Changing the default timeout#
The timeout values were picked as a reasonable default for the majority of use-cases, but can be modified using the
alter role statement:
_10-- For API users_10alter role authenticator set statement_timeout = '15s';
You can also update the statement timeout for a session:
_10set statement_timeout to 60000; -- 1 minute in milliseconds
All Supabase projects come with the
pg_stat_statements 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.
This data can further be used in conjunction with the
explain functionality of Postgres to optimize your usage.
Every Supabase database is set to UTC timezone by default. We strongly recommend keeping it this way, even if your users are in a different location. This is because it makes it much easier to calculate differences between timezones if you adopt the mental model that "everything in my database is in UTC time".
_10alter database postgres_10set timezone to 'America/New_York';
Full list of timezones#
Get a full list of timezones supported by your database. This will return the following columns:
name: Time zone name
abbrev: Time zone abbreviation
utc_offset: Offset from UTC (positive means east of Greenwich)
is_dst: True if currently observing daylight savings
_10select name, abbrev, utc_offset, is_dst_10from pg_timezone_names()_10order by name;
Search for a specific timezone#
ilike (case insensitive search) to find specific timezones.
_10select *_10from pg_timezone_names()_10where name ilike '%york%';