© 2026 Hedgehog Software, LLC

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

Is using range on RPC recommended?

Lets say I have a very large table and I am using a database function to query it like so:
const { data, error, count } = await supabase
          .schema("repairs")
          .rpc("get_tickets", params, { count: "exact", head: false })
          .range(100_000, 100_500);
const { data, error, count } = await supabase
          .schema("repairs")
          .rpc("get_tickets", params, { count: "exact", head: false })
          .range(100_000, 100_500);

Would this construct the result of the whole function first before returning the ranged part from it? Because one of my background tasks keeps failing after the range gets too high with
canceling statement due to statement timeout
canceling statement due to statement timeout
.

How can I improve this? This is probably less of a supabase question but more related to postgres.
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

Similar Threads

Was this page helpful?
Recent Announcements

Similar Threads

Recommended pattern for Return Types on RPC functions
SupabaseSSupabase / help-and-questions
7mo ago
Is there any downside to only using RPC functions?
SupabaseSSupabase / help-and-questions
2mo ago
Timeout on RPC Call
SupabaseSSupabase / help-and-questions
3mo ago
Grants on RPC Function execution
SupabaseSSupabase / help-and-questions
4y ago