Fly.io express app (Chicago) slow queries to Neon (Ohio)
I'm trying to figure out what the latency I'm experiencing is caused by. I'm comparing Fly postgres with Neon. The increase in latency is insane, and so I doubt the regional differences is the issue here. Cold starts aren't the issue either, since I've done queries in quick succession.
NeonDB scenario:
Fly env: DevFly region: ORD (Chicago)NeonDB region (US East - Ohio)findOne (sequelize ORM SELECT query containing association): 197.802ms
Fly env: DevFly region: ORD (Chicago)NeonDB region (US East - Ohio)findOne (sequelize ORM SELECT query containing association): 197.802ms
Fly postgres scenario:
Fly env: DevFly region: ORD (Chicago)Fly postgres: ORD (Chicago)findOne (sequelize ORM SELECT query containing association): 15.463ms
Fly env: DevFly region: ORD (Chicago)Fly postgres: ORD (Chicago)findOne (sequelize ORM SELECT query containing association): 15.463ms
I've been able to reproduce this 10x increase in latency consistently. I've done
EXPLAIN ANALYZE
EXPLAIN ANALYZE
and the query is not part of the issue.
The following scenario is 10 identical queries for a non-existing row (SELECT), happening over the course of 1 minute.
Something seems way off here, and I'm unsure what it is. Fly postgres seems WAY quicker, and I'm not sure if it's because it's not using a serverless model, or if it's because of the region also being ORD (Chicago), or if it's something else.
Sorry for the long post. Any assistance would be greatly appreciated.