SupabaseS
Supabase5mo ago
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);

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.

How can I improve this? This is probably less of a supabase question but more related to postgres.
Was this page helpful?