top | item 35530013

(no title)

jonasb | 2 years ago

Very interesting!

If I need to do more than one query to the database in series, my intuition is that it would be faster to make those calls in the same region as the database, rather than at the edge. It seems to be true using Vercel's playground[1] (towards Supabase).

Any guidance for Supabase based apps? Is it possible to run my functions close to the database?

[1] https://edge-data-latency.vercel.app/

discuss

order

kiwicopple|2 years ago

for when it really matters, then you should just use a Postgres Function. That will be an order of magnitude faster than anything you do to match the region.

Supabase has auto-generated APIs (using PostgREST), so you can execute a Postgres Functions like this:

    const { data, error } = await supabase.rpc('echo', { hello: 'world' })