R
Railway•3mo ago
ocosta

SLOW QUERIES

Hello, I'm from Brazil and I have a database hosted on Railway for a desktop application. I would like assistance to improve the query speed. Currently, I have the pro plan and the server is in Virginia.
24 Replies
Percy
Percy•3mo ago
Project ID: 6672a759-5b8b-46c8-be90-f607a400b533
ocosta
ocosta•3mo ago
6672a759-5b8b-46c8-be90-f607a400b533
Medim
Medim•3mo ago
@ocosta are you brazilian? if so, do you mind upvoting this community suggestion ? Bora trazer o Railway pro Brasil 😉 Also, what's the query latency? Can you be more specific on how much slow it is? reqs from Brazil -> USA you can expect 150-200+ ms
Brody
Brody•3mo ago
Hello, I'm from Brazil
are you brazilian?
Medim
Medim•3mo ago
that is my copy paste text 💀
Brody
Brody•3mo ago
i know 🤣
ocosta
ocosta•3mo ago
So I'm probably doing something wrong, and yes, I am Brazilian.
Medim
Medim•3mo ago
It's just your DB that is hosted on railway? or it's also your API?
ocosta
ocosta•3mo ago
DB
Medim
Medim•3mo ago
What type? Postgres?
ocosta
ocosta•3mo ago
MySQL its taking -+5s to do a query
Medim
Medim•3mo ago
ouch, you use an ORM or raw queries?
ocosta
ocosta•3mo ago
ORM, SQLAlchemy with PyQt6
Medim
Medim•3mo ago
I really don't know what could be slowing down your queries, I would blame SQLAlchemy 'cause railway doesn't seems like the culprit here. And since you are on the pro plan, I don't think its a hardware or a network limitation
ThallesComH
ThallesComH•3mo ago
@ocosta 150ms might not seem much but for database is a lot, maybe it's better to have an API in the same region that your desktop application uses had problems where my application was in the us-west region and the other on us-east, the latency went up about 1s and also this feature request would help you a lot because it would be in Brazil the database
ocosta
ocosta•3mo ago
In MySQL Workbench, the latency is around 200ms, but in the application, it's more than 5s
ThallesComH
ThallesComH•3mo ago
I was using Prisma(nodejs orm) in mine and it had the same problem
ocosta
ocosta•3mo ago
puts Switching from the ORM to the API, do you think it will improve?
ThallesComH
ThallesComH•3mo ago
100% use some encoding like gzip in your API and it'll help a lot also
ocosta
ocosta•3mo ago
I'll test it this way, thnks
ThallesComH
ThallesComH•3mo ago
if you're using Prisma, try out accelerate https://www.prisma.io/data-platform/accelerate
Prisma
Prisma Accelerate
Up to 1000x faster database queries with a global cache and scalable connection pool for serverless applications
ThallesComH
ThallesComH•3mo ago
I don't know if it works for your case, but it's worth a shot before building the API cc @ocosta
ocosta
ocosta•3mo ago
thnks, i'll read about it
Duchess
Duchess•3mo ago
New reply sent from Help Station thread:
Cara, me da um help, fiquei um tempo de abrir o railway e no meu banco de dados não tem mais a opção de mandar queries, nem de editar as colunas...pra onde foram essas coisas?
You're seeing this because this thread has been automatically linked to the Help Station thread. New reply sent from Help Station thread:
tsemh, please use English as this is an English only community. Though I have translated the message - that functionality is gone, please use a proper database client like dbgate
You're seeing this because this thread has been automatically linked to the Help Station thread. New reply sent from Help Station thread:
Alright, thank you bro.
You're seeing this because this thread has been automatically linked to the Help Station thread.