DEV Community

Alex Spinov
Alex Spinov

Posted on

PlanetScale Has a Free-Like Experience — Serverless MySQL With Branching, Zero-Downtime Migrations, and Vitess Under the Hood

MySQL is 30 years old and still powers most of the web. But managing MySQL in production — schema migrations, replication, scaling — is a full-time job.

PlanetScale takes MySQL and adds what it always needed: git-like branching for schemas, zero-downtime migrations, and serverless scaling. Built on Vitess, the same technology that powers YouTube.

Their Scaler plan starts at $39/month with generous usage, and they offer a Hobby tier for development.

What Makes PlanetScale Different

  • Schema branching — create a branch, modify schema, merge when ready
  • Zero-downtime migrations — deploy schema changes without locking tables
  • Built on Vitess — horizontal sharding that scales to billions of rows
  • Serverless driver — connect from edge/serverless without connection pooling
  • MySQL compatible — works with any MySQL client, ORM, or tool
  • Insights — query analytics and performance monitoring built in

Quick Start

1. Create a Database

Sign up at planetscale.com, create a database, grab your connection string.

2. Connect with Node.js (Serverless Driver)

npm install @planetscale/database
Enter fullscreen mode Exit fullscreen mode
import { connect } from "@planetscale/database";

const conn = connect({
  host: "aws.connect.psdb.cloud",
  username: "YOUR_USERNAME",
  password: "YOUR_PASSWORD",
});

// Query
const results = await conn.execute("SELECT * FROM users WHERE email = ?", [
  "alex@example.com",
]);
console.log(results.rows);

// Insert
await conn.execute(
  "INSERT INTO users (name, email) VALUES (?, ?)",
  ["Alex", "alex@example.com"]
);
Enter fullscreen mode Exit fullscreen mode

No connection pooling needed. Works in Vercel Edge Functions, Cloudflare Workers, Deno Deploy.

3. Connect with Python

import mysql.connector

conn = mysql.connector.connect(
    host="aws.connect.psdb.cloud",
    user="YOUR_USERNAME",
    password="YOUR_PASSWORD",
    database="mydb",
    ssl_ca="/etc/ssl/cert.pem"
)

cursor = conn.cursor(dictionary=True)
cursor.execute("SELECT * FROM users WHERE email = %s", ("alex@example.com",))
users = cursor.fetchall()
print(users)
Enter fullscreen mode Exit fullscreen mode

4. Schema Branching (The Killer Feature)

# Install CLI
brew install planetscale/tap/pscale

# Create a branch
pscale branch create mydb add-orders-table

# Switch to branch and modify schema safely
pscale shell mydb add-orders-table
> CREATE TABLE orders (
>   id BIGINT AUTO_INCREMENT PRIMARY KEY,
>   user_id BIGINT NOT NULL,
>   amount DECIMAL(10,2),
>   created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP
> );

# Create a deploy request (like a PR for your schema)
pscale deploy-request create mydb add-orders-table

# Deploy — zero downtime, no locks
pscale deploy-request deploy mydb 1
Enter fullscreen mode Exit fullscreen mode

This is the workflow every database should have had decades ago.

Real-World Use Case

A SaaS developer told me: "We had 3 hours of downtime last year from a MySQL ALTER TABLE on a 50M row table. With PlanetScale, the same migration took 0 seconds of downtime. The deploy request showed us exactly what would change before we merged."

Pricing

Feature Scaler ($39/mo)
Storage 10 GB
Row reads 1 billion/mo
Row writes 10 million/mo
Branches 3
Deploy requests Unlimited
Insights Yes
Horizontal sharding Enterprise

The Bottom Line

If you are running MySQL in production and doing migrations with fear and downtime — PlanetScale is what MySQL should have been from the start.

Schema branching alone is worth the switch. Zero-downtime migrations make it a no-brainer.


Need to scrape data and load it into your database? Check out my web scraping tools on Apify — extract structured data from any website and export as CSV/JSON for easy import.

Building something custom? Email me at spinov001@gmail.com


More Free APIs You Should Know About

Top comments (0)