Deploy Postgres and MySQL databases with PlanetScale + Workers
Key point
Cloudflare Workers now lets you create PlanetScale Postgres and MySQL directly, bundling billing together.
Details
Cloudflare plans to take its integration with PlanetScale deeper, allowing you to create Postgres and MySQL for Workers directly from the Cloudflare dashboard and API. Starting next month, new databases will be billed through your Cloudflare account, and Cloudflare credits and committed spend can also be used for payment.
If you already have a PlanetScale account connected, you can create a Postgres database from the Cloudflare dashboard, and Workers will connect to it automatically via Hyperdrive. Simply add a Hyperdrive binding to wrangler.jsonc and connect using env.DATABASE.connectionString; as an example, you can run queries like SELECT * FROM pg_tables using the pg client.
Cloudflare cited performance, reliability, and developer experience as the reasons for choosing PlanetScale. Users can continue using features like query insights, agent-driven SQL optimization workflows, and branching as-is, and existing regional databases can also be connected to globally distributed Workers via Hyperdrive for faster access.
To further reduce deployment latency, you can set a placement hint to run your Worker in a Cloudflare data center close to your database. For example, you can specify "region": "aws:us-east-1", and Cloudflare has also signaled a future direction where it automatically sets placement hints based on database location.
To summarize, you can currently deploy a PlanetScale Postgres database from the Cloudflare dashboard or connect an existing PlanetScale database to Workers, with billing still going through PlanetScale for now. Starting next month, new PlanetScale databases can be billed directly through your Cloudflare account, with starting pricing at $5/month for a single-node PlanetScale Postgres.
This summary was generated automatically by AI. Check the original for the author's claims and context. Copyright belongs to the original author.
Our guide explains how the AI works. Report summary errors, attribution issues, or removal requests via Contact.