r/Database • • 12h ago

Turso Cloud cold starts?

0 Upvotes

Does anyone have experience with Turso Cloud in production?

I am evaluating Turso Cloud as a a D1 replacement that's not tied to CloudFlare and I'm facing an unexpected situation that is making it unusable for me and I'm wondering if it's the product's fault or mine.

In particular: I'm facing cold start issues, which are supposed to be one of Turso's strengths ("it's just a file, nothing scales to zero"). The first query after the app has been idle for a few seconds is very slow. Every query right after it is fast.

There are two separate costs:

  1. Reconnecting. Node's fetch drops idle connections after 4 s, and Turso closes them after 5 s anyway. A new TCP+TLS connection costs about 110–140 ms from GCP in NL to their AWS in IE. Annoying, but expected (this is already making me question my sanity TBH).
  2. Something inside Turso. This is the weirdest part. Turso's own query_duration_ms, returned in the /v2/pipeline response, which leaves out the network, shows it:
Idle before the queryQuery after the pause (Turso's own time)Same query right after
1 s (baseline: not cold yet)0.6 ms0.1 ms
3 s (same connection, kept open)118 ms0.1 ms
10 s235 ms0.1 ms
30 s472 ms0.1 ms
60 s111 ms0.1 ms

That's a primary-key lookup that reads 0–2 rows on a freshly created test database!!

In my "production" DB it's even worse, the first query of a page load spends about 1 s inside Turso before anything else runs. That's very noticeable to users on EVERY page load that takes >4s from the latest access.

My guess is the diskless architecture, where the local disk is only a cache in front of S3, evicting idle databases very aggressively. But I can't find that documented anywhere and, well... it really is a deal breaker.

Is anyone running Turso Cloud in production with traffic that goes quiet for a few seconds at a time? Do you see this, and did you find a fix other than keeping the database warm?

All their marketing pages would point to the contrary ("even a cache miss that results in a disk read takes a few microseconds").

I don't want to maintain a local replica because my app is fully serverless with ephemeral state and, well, at that point I might as well just use SQLite locally.

Someone on Reddit faced a similar issue 3 years ago but that was before they announced this change which is supposed to remove cold starts and it was supposed to be >1hr to sleep, not seconds.


r/Database • • 9h ago

A free page that draws a PostgreSQL EXPLAIN ANALYZE plan as row flow

Post image
15 Upvotes

The part of a Postgres plan that's hard to read by eye is the row counts. They are per loop, and the estimate sits beside the actual with nothing to show how far apart the two are.

So I drew them. Each band is as wide as the rows that crossed it, over every loop. Where the estimate is off by more than 2×, it is drawn on the band: in the screenshot the planner expected 612 rows from `orders` and got 206,880, and every join after it inherits that.

Paste `EXPLAIN (ANALYZE, BUFFERS, FORMAT JSON)` output or the text format:

https://seqora.dev/explain/

The plan is read in the page and isn't uploaded. It draws one plan at a time, saves nothing, and can't see your database.

I make Seqora, a desktop database client, and this is its plan view. In the app it runs EXPLAIN on your own connection, and that part is paid. The page is free.