R
Railwayβ€’10mo ago
misimilen

Intentionally slow databases in free tier?

I'm trying out railway for our web app and must say I feel like the database is intentionally very slow to execute simple queries that returns no rows. Is this intentionally slow so as not to hog up resources in free tier? Can I expect better performance in Enterprise? It takes 150ms to execute this query that returns nothing. Compared to my local database that does this in 2-3 ms. And that's me running on a weak laptop πŸ™‚
railway.public> SELECT t.*
FROM public."Account" t
LIMIT 501
[2023-10-03 21:43:09] 0 rows retrieved in 165 ms (execution: 156 ms, fetching: 9 ms)
railway.public> SELECT t.*
FROM public."Account" t
LIMIT 501
[2023-10-03 21:43:09] 0 rows retrieved in 165 ms (execution: 156 ms, fetching: 9 ms)
11 Replies
Percy
Percyβ€’10mo ago
Project ID: N/A
misimilen
misimilenβ€’10mo ago
N/A
MantisInABox
MantisInABoxβ€’10mo ago
If you are on the hobby plan, all your deployments are in us-west-1, so, depending on where you are located, you could be running into latency issues.
misimilen
misimilenβ€’10mo ago
But the fetching is at 9ms, the execution happens on the server. riiight?? or no?
MantisInABox
MantisInABoxβ€’10mo ago
I missed that part. My bad. I don’t think it’s intentionally slowed down though
misimilen
misimilenβ€’10mo ago
Alright, it also seems to crash now and then because when deploying my api it says
> cd packages/backend && npx prisma migrate deploy

npm WARN config production Use `--omit=dev` instead.

Prisma schema loaded from prisma/schema.prisma

Datasource "db": PostgreSQL database "railway", schema "public" at "containers-us-west-120.railway.app:7756"

Error: P1001: Can't reach database server at `containers-us-west-120.railway.app`:`7756`

Please make sure your database server is running at `containers-us-west-120.railway.app`:`7756`.
> cd packages/backend && npx prisma migrate deploy

npm WARN config production Use `--omit=dev` instead.

Prisma schema loaded from prisma/schema.prisma

Datasource "db": PostgreSQL database "railway", schema "public" at "containers-us-west-120.railway.app:7756"

Error: P1001: Can't reach database server at `containers-us-west-120.railway.app`:`7756`

Please make sure your database server is running at `containers-us-west-120.railway.app`:`7756`.
In case any railway employee sees this, my project id is c39b75c1-5e52-4d8e-b559-4cc3d1c83383.
Brody
Brodyβ€’10mo ago
Can't reach database server at containers-us-west-120.railway.app:7756
this can be caused by the private network initialization times, even if you arent using the private network, its enabled by default, the fix being disable the private network or increase the connection timeout, and in some edge cases a retry loop may be needed
misimilen
misimilenβ€’10mo ago
Hmm okay, I will try to diaable it tomorrow. I also tested with a database hosted outside of railway. Bpth these works sometimes, and sometimes not.. so it must be what u say with some weird timeout. Unfortunately it seems I'll have to go with an external postgres because the postgres performance are for some reason unreasonably slow. I think it mist be misconfigured or smth I hoped upgrading to a pro plan would do the trick πŸ˜†
Brody
Brodyβ€’10mo ago
can you do me a favor and test this database? https://railway.app/template/postgres
misimilen
misimilenβ€’10mo ago
Equally slow 😦 That did it, now my service seems to be able to connect to the db(my external) every restart.
Brody
Brodyβ€’10mo ago
it's very odd that it's so slow, it's just a postgres docker image, nothing fancy at all