2 years ago
I'm running about 1000-1200 raw queries (logged through Prisma) in a few seconds and am getting wait times of 20-30 seconds for something that takes 1ms with pg's EXPLAIN ANALYZE.
I don't see anything spike in the Railway panels for our Postgres instance either. The only one that spikes is outbound, which hit about 120mb. I don't think that's unreasonable though and shouldn't be causing these long load times and backup.
It could be:
network latency (maybe we are querying too much info?)
a Prisma issue
a Postgres issue
a Railway config issue with Prisma and/or Postgres
Has anyone run into anything similar? Am I using Prisma incorrectly? I've barely changed any of the default settings.
15 Replies
2 years ago
how are you connecting to the database? try using the private network if you aren't already
I am using a conneciton_url through Prisma that is essentially just the pg user / password. Can you elabroate on the private network?
2 years ago
try using DATABASE_PRIVATE_URL
Testing now, but i was hoping to have a solution that works even when running on localhost. As far as I know, 1000 queries in a 10 second query per user isn't anything crazy, right?
Just tested using the private database URL, this did not fix the issue and we are still seeing long load time
2 years ago
try making the same queries using raw SQL, as to eliminate prisma as the issue
I can try that. Do you have preferred typescript postgres client / lib that would be good to try this with?
2 years ago
I think the go to pg npm package would be more than sufficient
@Brody was able to confirm the issue still happens when using pg raw over prisma
2 years ago
and you are now connecting over the private network?
2 years ago
is there some postgres config you can tweak? the postgres databases railway deploys are not managed in any way, they are just the bog standard postgres docker images provided by postgres with SSL on top
I see. I just tried saving our data to a local postgres server and I'm still running into this issue, so I agree it's likely not a railway specific config thing. What sorts of postgres config hve you seen for issues like this? I'm absolutely baffled so any help would be appreciated