Shaf Lab

Serverless SQL

A SQL database that scales with your functions, such as Cloudflare D1.

Serverless SQL is a relational database that scales with your functions and does not ask you to size a server in advance. Cloudflare D1 is one example, designed to sit close to Workers; other vendors offer similar 'pay for what you query' SQL. You still get tables, queries, and transactions, with a connection model that fits short-lived compute.

It is a good fit for application records that need a schema and occasional joins, and for work that already lives on an edge or serverless platform. It is a weaker fit for heavy analytical scans or for features that assume a long-lived connection and a large in-memory cache on the database host.

Design for the limits: request time, row size, and how migrations run in production. Keep writes explicit, and be careful with chatty queries on a tight CPU budget. A boring schema with a few well-chosen indexes will take you further than a clever one.

If all you need is a blob by key, do not start here. Serverless SQL earns its place when the data is relational and the compute is already serverless.