Cloudflare Hyperdrive exists because of a specific, unglamorous problem: a Worker running in two hundred cities talking to one Postgres database in one city is slower than the same query issued from a single server sitting next to that database. Not slightly slower. Often several times slower, and for reasons that have nothing to do with how the query is written.
The instinct when a serverless app feels sluggish is to blame the query planner or add an index. On Workers talking to a regional database, the query is usually fine. The connection is the problem.
What Hyperdrive actually fixes: the cost of establishing a database connection, paid on every single request. A Postgres connection needs a TCP handshake, a TLS negotiation and an authentication exchange before one row moves, and each of those is a round trip from wherever the Worker woke up to wherever the database lives. Hyperdrive keeps warm connections near your database and pools them, so the Worker borrows an open connection instead of building one.
Why a Worker Talking Straight to Postgres Is Slow
A traditional application server opens a pool of connections once at boot and reuses them for the life of the process. The handshake cost is paid at startup and then spread across millions of requests until someone restarts the service.
Workers do not work that way. Each invocation is short-lived and may run in any Cloudflare location. There is no long-lived process holding a pool, so without help every request pays the full setup cost, and it pays that cost across the distance from the edge to your origin database.
Three round trips before the first byte of data is not a tuning problem. A user in Sydney hitting a Worker that talks to Postgres in London pays that latency four times over: TCP, then TLS, then authentication, then finally the query. The query itself might take two milliseconds.
There is a second, quieter failure. Postgres allocates a backend process per connection and its maximum is finite, typically a few hundred. A Worker that scales to thousands of concurrent invocations will exhaust that pool and start collecting connection refusals during exactly the traffic spike you built the edge to handle.
What Hyperdrive Does About It
Hyperdrive sits between the Worker and the database as a connection pooler that Cloudflare operates on your behalf. It maintains warm connections to your origin, so an invocation borrows one rather than negotiating a new one from scratch.
It also caches query results. Read queries that repeat can be served without touching the origin at all, which turns a latency question into a cache-hit question for a meaningful share of traffic. Writes and anything non-deterministic pass straight through.
Configuration is a connection string. You register the database with Cloudflare, receive a Hyperdrive binding, and point your existing Postgres driver at that binding instead of at the database. The driver, the SQL and the schema do not change. That matters more than it sounds, because it means the change is reversible and you can measure it against a direct connection without rewriting anything.
The Numbers That Decide Whether It Fits
Verified against Cloudflare documentation in August 2026, and worth re-checking before you commit, because these move.
| Workers Free | Workers Paid | |
|---|---|---|
| Cost | Included | Included |
| Queries | 100,000 per day | Unlimited |
| Configured databases | 10 per account | 25 per account |
| Origin connections per config | around 20 | around 100 |
| Query duration limit | 60 seconds | 60 seconds |
| Cached response size | 50 MB | 50 MB |
Hyperdrive carries no additional charge on either plan , and there are no egress fees. What counts as a query is broad: a select, an insert, an update, a delete or a schema change all count, and cached queries count the same as uncached ones. The free daily allowance resets at midnight UTC.
The limits documentation lists an initial connection timeout of 15 seconds and an idle timeout of 10 minutes. The 60-second query ceiling is the one that catches teams migrating a reporting workload: an analytical query that takes two minutes on a cron job will simply fail here.
Which Databases Actually Work
Hyperdrive supports PostgreSQL 9.0 through 17.x and MySQL 5.7 through 8.x , self-hosted or managed. MariaDB is covered under MySQL compatibility.
Named managed providers include AWS Aurora in both its Postgres and MySQL-compatible forms, Neon, Supabase, Timescale, Materialize, CockroachDB and PlanetScale. Managed instances on Azure and Google Cloud work as well.
The practical constraint is not the engine, it is reachability. Your database has to be addressable from Cloudflare’s network. A Postgres instance sealed inside a private VPC with no public endpoint needs a tunnel or a peering arrangement before Hyperdrive can see it at all, and that is a networking project rather than a configuration change.
When Cloudflare Hyperdrive Is the Wrong Answer
When the data belongs at the edge. If your access pattern is key-value lookups, Workers KV is faster and simpler. If you want a small relational database that lives near the Worker rather than in one region, D1 is the product designed for that. Hyperdrive is for when you already have Postgres or MySQL and intend to keep it.
When the workload is analytical. The 60-second ceiling and the per-query accounting suit transactional traffic. Long aggregations belong on a job runner talking to the database directly.
When you have not measured. The failure we see most often is a team adding Hyperdrive to an application that was never connection-bound in the first place. If a Worker is slow because it makes six sequential queries where one would do, pooling those six connections makes it marginally less slow and leaves the actual problem untouched.
That measurement is worth doing properly before any of this. Our comparison of Cloudflare Workers and AWS Lambda covers where edge execution genuinely wins, and Cloudflare D1 covers the case where moving the database beats accelerating the route to it.
Getting the Decision Right
Time one request end to end on a direct connection, then again through Hyperdrive, from a location far from your database. If the gap is small, your latency lives somewhere else and you have saved yourself a dependency. If the gap is large, you have found real money.
Mecanik builds and reviews edge architectures through our software development team, including the unglamorous part where somebody measures what is actually slow before anything gets rearchitected. If your serverless application is slower than the server it replaced, the connection path is the first place to look.