d1 or neon behind a worker for 30 req/s and about 2 gb of data D1
Read-heavy internal dashboard. Roughly 2 GB today growing slowly, 30 req/s sustained during working hours, mostly indexed single-table reads with two or three joins on the heavier pages. Writes are maybe 1% of traffic.
Team of two. I am worried about D1 size and query planning on one side, and about paying a round trip to a single Postgres region from every edge location on the other. Has anyone actually run both and got a view?
@ridgeline_rowan · 6mo ago · 3 replies
It comes down to where your reads have to travel, and both options have a version of that problem.
D1: 2 GB is well inside the limit, and 30 req/s of indexed reads is not a challenging number. The catch is that writes go to a primary, so a user far from it pays the round trip on anything that writes, and read replication is what you reach for to keep reads local. With 1% writes that trade looks good for you.
Neon from a Worker: use the serverless HTTP driver, not a TCP pool. There is no connection to keep warm over HTTP, which is the only reason this is viable from an isolate at all. What you are paying instead is a full round trip to whatever region your Neon project lives in, on every query. If the Worker runs in Sydney and Neon is in Virginia, that is 200ms+ before the query even starts, and your three-join dashboard page issuing four queries in sequence is now a second of pure network.
Decision rule I would use: if you want Postgres features you can name — real window functions, extensions, pgvector later — take Neon and stop pretending the Worker's location matters, put your logic where the data is. If your queries are boring and latency is the product, take D1.
Reply
Report
@orm_tamsin · 6mo ago
"Put your logic where the data is" cuts through a lot of my confusion. I was trying to have edge compute and a single-region database and treat the combination as free.
Reply
Report
@seedstart_sim · 6mo ago
If you do go Neon, put the Cache API in front of the read paths. 30 req/s of a dashboard is mostly the same handful of queries answered repeatedly, and a 30 second cache turns a database problem into a non-problem. That is true either way, it is just more valuable when each query costs you a continent.
Reply
Report