Supabase 'Canceling Statement Due to Statement Timeout'
Workaround available Web, server (all SDKs) Updated October 21, 2026
Quick answer
The query ran longer than the role's statement_timeout (API roles default to a few seconds). Add indexes and optimize the query first; raise the timeout for the role only if needed.
Most likely fix: Find the slow query.
Symptoms
API requests fail with error 57014 'canceling statement due to statement timeout', usually on large tables, complex RLS policies or bulk operations.
Why it happens
- Missing indexes on filtered or joined columns
- RLS policies calling functions per row
- Large unpaginated selects or bulk updates
- Low default timeout for anon/authenticated roles
How to fix it
Try these in order — the most common fix is first.
1. Find the slow query
- Dashboard > Reports > Query Performance
- Run EXPLAIN ANALYZE, or .explain() from supabase-js
2. Add indexes
- Index columns used in filters, joins and RLS policies (e.g. user_id)
- Use the Index Advisor in the dashboard
3. Optimize RLS policies
- Wrap auth.uid() as (select auth.uid()) so it runs once per query
- Avoid per-row function calls in policies
4. Raise statement_timeout for the role
- Run: alter role authenticated set statement_timeout = '15s';
- Reload config or restart the project if the change doesn't apply
5. Paginate large requests
- Use .range() or limit/offset instead of selecting whole tables
This guide also covers
- supabase statement timeout
- supabase canceling statement due to statement timeout
- supabase 57014
- supabase query slow
Still not working?
If Supabase keeps failing, you're not alone. See every Supabase problem users report or the alternatives people switch to.
Other Supabase errors
- Supabase Project Paused
- Supabase Max Client Connections Reached
- Supabase 'New Row Violates Row-Level Security Policy' Error
- Supabase Confirmation Email Not Sending
- Supabase Auth Redirects to Localhost
- Supabase 'Invalid Refresh Token: Refresh Token Not Found'
- Supabase Edge Function 546 WORKER_LIMIT Error
- Supabase Storage Upload Failed
- Supabase Realtime Not Working
- Supabase Database Connection 'Network Is Unreachable'
- Supabase Start Not Working (Docker Container Unhealthy)