Is it possible to have sub-1-second queries using Supabase? #32669
Unanswered
lancejpollard
asked this question in
Questions
Replies: 2 comments
-
Beta Was this translation helpful? Give feedback.
0 replies
-
I switched to PlanetScale ($39 smallest plan), and the same query is now taking from 650-850ms, so 2x as fast or more basically. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I am using edge functions for querying the supabase database. Why does it sometimes say (in the edge function logs, where my db calls are made using Kysely) 6s, 8s, 10 seconds even, to do a query! And why does it even take 1-2 seconds in "best case", I run this locally and it takes only like 300-500ms.
Can you please explain in detail how this works, I am wondering if this is a problem all "database as a service" companies face (Neon, PlanetScale, Fly.io, etc.), or it's just a Supabase issue. I'm wondering what I can do to mitigate it and make my queries sub-1-second, even though I have tons of indexes already.
In what situations can you have sub-1-second queries on supabase? How does it work? What is the most complex example you have seen to demonstrate a semi-complex query responding in under 1 second on Supabase?
It appears after not making an edge function request for a while (like after coming home after a day at the office), I make the first request and it might take 10 seconds!! Then I CMD+R refresh the browser and each time after it's about 1.5-2 seconds. Before switching to edge functions, and just using a direct PostgreSQL connection to supabase from Kysely from a Next.js
route.ts
hosted on Vercel, I was getting 800ms-1.5s, now using edge functions it's gone up to 1.5-2s. Running the query against a test database locally it is like 300-500ms.Here is me calling my edge function several times (Vercel/Next.js route calls edge function, edge function makes ~10 db calls with kysely, and then finally route returns JSON response).
Edit, I noticed I had
Fast 4G
throttling on, but changing it to no throtting (Chrome Network tab), doesn't change any timing.Also note, my "region" of Supabase is the similar region of my Vercel app.
Beta Was this translation helpful? Give feedback.
All reactions