© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
SupabaseS
Supabase•7mo ago•
7 replies
Hector

Cancelling statement due to statemtn timeout

i am experiencing an issue where a query to a table is timing out and I am not sure why.

the query is
const { data: cameras, error } = await supabase

.from("cameras")

.select(

"id,location,device_name,ip_address,physical_status,online_status,last_status_change"

);
const { data: cameras, error } = await supabase

.from("cameras")

.select(

"id,location,device_name,ip_address,physical_status,online_status,last_status_change"

);


however, when i navigate to my page /reports/dynamic/cameras

i see that the request fails here are my terminal logs showing the error and request time
cameras route time: 6794
cameras route time: 2025
cameras route time: 10341
Error fetching cameras from Supabase: {
  code: '57014',
  details: null,
  hint: null,
  message: 'canceling statement due to statement timeout'
}
cameras route time: 7912
cameras route time: 179
cameras route time: 191
cameras route time: 8757
cameras route time: 134
cameras route time: 181
cameras route time: 154
cameras route time: 6794
cameras route time: 2025
cameras route time: 10341
Error fetching cameras from Supabase: {
  code: '57014',
  details: null,
  hint: null,
  message: 'canceling statement due to statement timeout'
}
cameras route time: 7912
cameras route time: 179
cameras route time: 191
cameras route time: 8757
cameras route time: 134
cameras route time: 181
cameras route time: 154



the amount of cameras in the table are 433 so the query should be pretty fast,
what could the issue possibly be?


I have indexes on the table, simple rls policies, and when running

EXPLAIN (ANALYZE, BUFFERS)

SELECT id, location, device_name, ip_address, physical_status, online_status, last_status_change

FROM public.cameras
EXPLAIN (ANALYZE, BUFFERS)

SELECT id, location, device_name, ip_address, physical_status, online_status, last_status_change

FROM public.cameras


i get the following
[
  {
    "QUERY PLAN": "Seq Scan on cameras  (cost=0.00..21.33 rows=433 width=83) (actual time=0.594..2.797 rows=433 loops=1)"
  },
  {
    "QUERY PLAN": "  Buffers: shared read=17"
  },
  {
    "QUERY PLAN": "Planning:"
  },
  {
    "QUERY PLAN": "  Buffers: shared hit=136689 read=98117"
  },
  {
    "QUERY PLAN": "Planning Time: 8175.206 ms"
  },
  {
    "QUERY PLAN": "Execution Time: 4.384 ms"
  }
]
[
  {
    "QUERY PLAN": "Seq Scan on cameras  (cost=0.00..21.33 rows=433 width=83) (actual time=0.594..2.797 rows=433 loops=1)"
  },
  {
    "QUERY PLAN": "  Buffers: shared read=17"
  },
  {
    "QUERY PLAN": "Planning:"
  },
  {
    "QUERY PLAN": "  Buffers: shared hit=136689 read=98117"
  },
  {
    "QUERY PLAN": "Planning Time: 8175.206 ms"
  },
  {
    "QUERY PLAN": "Execution Time: 4.384 ms"
  }
]


a large about of time is spent in planning.


any thoughts on what may be causing the issue?
Supabase banner
SupabaseJoin
Supabase gives you the tools, documentation, and community that makes managing databases, authentication, and backend infrastructure a lot less overwhelming.
45,816Members
Resources
Was this page helpful?

Similar Threads

Recent Announcements

Similar Threads

cancelling statement due to statement timeout
SupabaseSSupabase / help-and-questions
8mo ago
canceling statement due to statement timeout
SupabaseSSupabase / help-and-questions
3y ago
canceling statement due to statement timeout
SupabaseSSupabase / help-and-questions
4y ago
debugging `canceling statement due to statement timeout` error
SupabaseSSupabase / help-and-questions
4y ago