P
Prisma2w ago
JVQ

Slow queries 1/2 on a simple SELECT by ID PGSQL

Hello, we're using Prisma on the FREE plan right now. We do have issues with random latencies on some random queries, please find some examples attached in this email. The query is a pretty simple SELECT in a table that currently have only 250 records. It seems like there is a cold start that take more than > 3 secs long before executing the query but we are unsure and we don't find anything related to it. :what: Please can you tell us if there is a cold start thing or something else that is causing this issue? Thanks for your help
No description
12 Replies
Prisma AI Help
Ahoy, knowledge seeker! I'm the Prisma AI Help Bot. Do you want a dev's response that might take a hot second, or an AI answer that's ready before your next coffee sip? Either way, your question is important to us.
Nurul
Nurul2w ago
Hey 👋 Just to confirm, are you using Prisma Postgres database or are you using Prisma Accelerate with another hosted database? Can you let me know the email address with which you signed up?
JVQ
JVQOP2w ago
@Nurul we share our workspace with my dev team on [email protected]
Nurul
Nurul2w ago
Is this happening in the production environment of project named "Le Plein API"?
JVQ
JVQOP2w ago
Yes @Nurul it is queries are simple select through our nestjs api (there is no compute)
Nurul
Nurul2w ago
Thanks for confirming. I am taking a look
JVQ
JVQOP2w ago
Ok @Nurul thanks Any update @Nurul concerning our issue?
Nurul
Nurul2w ago
Apologies for the delay. I checked the logs. I think I understand what is causing these additional latencies, I noticed that your traffic is sporadic, it is not consistently receiving requests. At the moment, we have an internal component known as Query Engines which is responsible for managing incoming database queries. If there are no incoming requests in a timespan of 10 mins, the QE is shutdown and is restarted when a new request is received. So, when a request is received after a long time of idle period, it has this additional overhead which causes the additional latency. This is going to change soon, as we are tackling reducing this overhead in this quarter. For now, if you ensure that there is atleast one request every 10 mins, it would prevent the QE from shutting down and you shouldn't face these additional latency
JVQ
JVQOP2w ago
So it's basically a coldstart latency @Nurul it's quite sad but we can't make a 3sec response for a so simple query.... we're sad but we have to go back to Neon then
Nurul
Nurul2w ago
Just to confirm, is your database region and your app region close to each other? One thing that caught my attention is that the first two queries are only a minute apart, so the Query Engine should not have shutdown. I escalated it to our Prisma Postgres team. Please allow me to get back to you with insights from them. We would love to get to the root of this issue to fix it 🙏
JVQ
JVQOP2w ago
Ok thank you We just implemented Neon PG database and we now have 25-30ms query replies @Nurul any news @Nurul ?
Nurul
Nurul7d ago
As the traffic is intermittent and the way how scaling works in Prisma Postgres, you are currently facing this cold start. We have planned to fix this in coming 1-2 months, which should improve this drastically. I'll let you know as soon as this is shipped. If the database receives consistent traffic then the performance should improve 🙏

Did you find this page helpful?