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. 1. Find the slow query

    1. Dashboard > Reports > Query Performance
    2. Run EXPLAIN ANALYZE, or .explain() from supabase-js
  2. 2. Add indexes

    1. Index columns used in filters, joins and RLS policies (e.g. user_id)
    2. Use the Index Advisor in the dashboard
  3. 3. Optimize RLS policies

    1. Wrap auth.uid() as (select auth.uid()) so it runs once per query
    2. Avoid per-row function calls in policies
  4. 4. Raise statement_timeout for the role

    1. Run: alter role authenticated set statement_timeout = '15s';
    2. Reload config or restart the project if the change doesn't apply
  5. 5. Paginate large requests

    1. 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