Skip to main content
← All Articles Β· Β· 11 min read

Serverless Database Guide: PlanetScale vs Neon vs Turso vs Upstash 2026

Which serverless database fits your stack in 2026? Compare PlanetScale, Neon, Turso, and Upstash: HTTP drivers, connection pooling, pricing, branching, and use case recommendations.

databaseserverlessplanetscaleneontursoupstashsql

Serverless Database Guide: PlanetScale vs Neon vs Turso vs Upstash 2026

Traditional databases break in serverless environments. TCP connection overhead, connection pool limits, and lack of scale-to-zero make PostgreSQL and MySQL poorly suited for Lambda and edge functions by default. The serverless database ecosystem emerged to solve this β€” offering HTTP-based drivers, automatic scaling, and pay-per-request pricing. Here is the definitive 2026 comparison.

Why Traditional Databases Fail in Serverless

The core problem: Lambda functions are ephemeral and can scale to thousands of concurrent instances in seconds. A traditional database like PostgreSQL supports ~100-1000 concurrent connections before performance degrades.

Scale EventTraditional DBServerless DB
Lambda scaling to 500 concurrent500 TCP connections β€” DB overwhelmedHTTP connections β€” handled via connection pool
Scale to zero between requestsIdle connections held open (wasteful)No persistent connections needed
Cold start penaltyNew TCP connection + SSL handshake: ~50msHTTP: ~5ms
Edge function accessNot possible (no TCP)HTTP driver works everywhere

The solution: databases with HTTP-based drivers, built-in connection pooling, and architecture designed for ephemeral compute.


PlanetScale: MySQL + Vitess at Scale

PlanetScale is a MySQL-compatible database built on Vitess (the same sharding system that powers YouTube’s MySQL infrastructure). It is known for its database branching workflow and horizontal scalability.

Key Features

  • MySQL 8.0 compatible: Drop-in replacement for MySQL workloads
  • Vitess under the hood: Horizontal sharding, connection pooling built-in
  • Database branching: Create branches for development, run migrations, merge to production
  • HTTP driver: @planetscale/database β€” works in edge functions and Lambda
  • Non-blocking schema changes: Deploy DDL changes without locking tables

Connection Model

import { connect } from '@planetscale/database';

// Works in Cloudflare Workers, Vercel Edge, Lambda
// Uses fetch() under the hood β€” no TCP required
const db = connect({
  host: process.env.DATABASE_HOST,
  username: process.env.DATABASE_USERNAME,
  password: process.env.DATABASE_PASSWORD,
});

// Standard SQL queries
const { rows } = await db.execute(
  'SELECT id, name, email FROM users WHERE plan = ? LIMIT ?',
  ['pro', 100]
);

// With ORM (Drizzle works with PlanetScale HTTP driver)
import { drizzle } from 'drizzle-orm/planetscale-serverless';
const drizzleDb = drizzle(db);
const users = await drizzleDb.select().from(usersTable).where(eq(usersTable.plan, 'pro'));

Pricing (2026)

  • Scaler Pro plan (pay-as-you-go): Starts at $39/month for 10 billion row reads and 50M row writes
  • Note: PlanetScale removed its free tier in 2024. Development requires a paid plan.
  • Sharded plan: Custom pricing for databases requiring horizontal partitioning

Best For

Large MySQL workloads, teams familiar with MySQL, applications requiring horizontal sharding, Vitess-powered high-throughput systems. The branching workflow is excellent for teams practicing trunk-based development.

Limitation: No free tier makes it less suitable for hobby projects and early-stage startups.


Neon: Serverless PostgreSQL with Branching

Neon is a serverless PostgreSQL service built on a custom storage architecture that separates compute and storage. The key innovation is true scale-to-zero β€” compute shuts down when idle and restarts in under 500ms.

Key Features

  • PostgreSQL 16 compatible: Full PostgreSQL, not a subset
  • Scale to zero: Compute pauses when idle (free tier uses this aggressively)
  • Database branching: Git-like branching for databases β€” useful for preview environments
  • Serverless driver: @neondatabase/serverless β€” HTTP or WebSocket-based, works in edge environments
  • Connection pooling: Built-in PgBouncer via ?pgbouncer=true connection string parameter

Connection Model

import { neon, neonConfig } from '@neondatabase/serverless';

// HTTP mode (for edge functions β€” no persistent connection)
const sql = neon(process.env.DATABASE_URL!);
const users = await sql`SELECT id, name FROM users WHERE active = true LIMIT 10`;

// WebSocket mode (for Lambda β€” better for multiple queries per invocation)
import { Pool } from '@neondatabase/serverless';
import ws from 'ws';

neonConfig.webSocketConstructor = ws; // Required in Node.js environments

const pool = new Pool({ connectionString: process.env.DATABASE_URL });
const client = await pool.connect();
try {
  const { rows } = await client.query('SELECT * FROM orders WHERE user_id = $1', [userId]);
  return rows;
} finally {
  client.release();
}

// With Drizzle ORM
import { drizzle } from 'drizzle-orm/neon-http';
const db = drizzle(sql);
const result = await db.select().from(users).where(eq(users.active, true));

Branching for Preview Environments

# Neon CLI β€” create a branch for a PR
neon branches create --name preview/pr-123 --parent main

# Get connection string for preview branch
neon connection-string preview/pr-123

# In CI/CD: create branch on PR open, delete on merge
# Each branch gets its own compute + isolated copy of main schema
# Storage is shared-on-write (branches share unchanged pages with parent)

Pricing (2026)

  • Free tier: 0.5 CPU, 1GB RAM, 10GB storage, 5 branches, compute pauses after 5 minutes idle
  • Launch plan: $19/month β€” 10 projects, 10GB storage, always-on option
  • Scale plan: $69/month β€” custom compute sizes, more storage

Best For

PostgreSQL workloads, teams using Prisma/Drizzle with PostgreSQL, preview environments via branching, projects needing a free tier for development.


Turso: SQLite at the Edge

Turso is a distributed SQLite service built on libSQL (a fork of SQLite). It deploys SQLite databases close to users via replica placement, enabling sub-10ms query latency for read-heavy workloads.

Key Features

  • SQLite-compatible: Standard SQLite SQL dialect
  • libSQL driver: HTTP-based, works in edge environments
  • Multi-region replicas: Databases replicated to Cloudflare PoPs
  • Per-database pricing: Each application can have its own database (useful for multi-tenant SaaS)
  • Embedded replicas: Sync a local in-process SQLite replica from Turso (zero-latency reads)

Connection Model

import { createClient } from '@libsql/client';

// HTTP mode (edge-compatible)
const db = createClient({
  url: process.env.TURSO_DATABASE_URL!,
  authToken: process.env.TURSO_AUTH_TOKEN!,
});

// Standard SQLite queries
const { rows } = await db.execute({
  sql: 'SELECT id, title FROM posts WHERE author_id = ? ORDER BY created_at DESC LIMIT ?',
  args: [authorId, 20],
});

// Transactions
const { rowsAffected } = await db.batch([
  { sql: 'UPDATE accounts SET balance = balance - ? WHERE id = ?', args: [amount, fromId] },
  { sql: 'UPDATE accounts SET balance = balance + ? WHERE id = ?', args: [amount, toId] },
], 'write');

// Embedded replica (zero-latency reads, syncs from Turso)
const localDb = createClient({
  url: 'file:local.db',
  syncUrl: process.env.TURSO_DATABASE_URL,
  authToken: process.env.TURSO_AUTH_TOKEN,
});
await localDb.sync(); // Sync from primary

Pricing (2026)

  • Free tier: 500 databases, 9GB storage, 1B row reads/month
  • Scaler plan: $29/month β€” 30,000 databases, unlimited storage, 100B reads
  • Per-database pricing: Makes it excellent for multi-tenant apps

Best For

Multi-tenant SaaS (one database per tenant), SQLite-compatible workloads at the edge, read-heavy applications benefiting from geographic replicas, embedded applications needing local-first with cloud sync.

Limitation: SQLite has no native JSON operators as powerful as PostgreSQL’s JSONB. Complex relational queries are more limited than PostgreSQL.


Upstash: Redis and Kafka, Pay-Per-Request

Upstash provides serverless Redis (via HTTP API) and Kafka, optimized for ephemeral compute. Unlike traditional Redis which charges for reserved instances, Upstash charges per command executed.

Key Features

  • Redis API compatible: Drop-in replacement for most Redis workloads
  • HTTP REST API: Works in edge functions and Lambda (no TCP/Redis protocol needed)
  • Kafka: Serverless Kafka clusters with the same pay-per-message model
  • Global replication: Multi-region Redis databases
  • QStash: Serverless message queue for scheduling and background jobs

Connection Model

import { Redis } from '@upstash/redis';

// HTTP-based Redis client β€” works everywhere
const redis = new Redis({
  url: process.env.UPSTASH_REDIS_REST_URL!,
  token: process.env.UPSTASH_REDIS_REST_TOKEN!,
});

// Standard Redis operations
await redis.set('user:123:session', JSON.stringify(sessionData), { ex: 3600 });
const session = await redis.get<SessionData>('user:123:session');

// Rate limiting with Upstash Ratelimit
import { Ratelimit } from '@upstash/ratelimit';

const ratelimit = new Ratelimit({
  redis: Redis.fromEnv(),
  limiter: Ratelimit.slidingWindow(100, '1 m'), // 100 requests per minute
});

const { success, remaining } = await ratelimit.limit(userIp);
if (!success) {
  return new Response('Rate limited', { status: 429 });
}

// QStash: schedule delayed messages
import { Client as QStashClient } from '@upstash/qstash';
const qstash = new QStashClient({ token: process.env.QSTASH_TOKEN! });
await qstash.publishJSON({
  url: 'https://api.example.com/webhooks/process',
  delay: 60, // seconds
  body: { orderId: '123', action: 'fulfill' },
});

Pricing (2026)

  • Free tier: 10,000 commands/day, 256MB storage
  • Pay-as-you-go: $0.20 per 100,000 commands
  • Pro plan: $280/month β€” dedicated instances, unlimited commands

Best For

Session storage, rate limiting at edge, caching, leaderboards, pub/sub, background job scheduling (QStash). Upstash Redis is the go-to Redis replacement for serverless environments.


Comparison Table

FeaturePlanetScaleNeonTursoUpstash Redis
Database typeMySQL (Vitess)PostgreSQLSQLite (libSQL)Redis
Free tierNo (removed 2024)Yes (0.5 CPU, 1GB)Yes (500 DBs)Yes (10K cmd/day)
Edge-compatibleYes (HTTP driver)Yes (HTTP driver)Yes (HTTP driver)Yes (HTTP API)
BranchingYesYesNoNo
Scale to zeroNoYesYesYes
Multi-regionVia shardingPlannedYes (replicas)Yes
Starting price$39/monthFreeFreeFree
Best use caseLarge MySQL appsPostgreSQL + branchingEdge SQLite, SaaSCaching, sessions

Recommendations

  • PostgreSQL users: Start with Neon β€” free tier, full PostgreSQL, excellent branching, works with Prisma and Drizzle
  • MySQL/high-scale: Use PlanetScale if you need Vitess-grade scalability and can absorb the $39/month cost
  • Edge-first or multi-tenant SaaS: Turso β€” cheapest per-database pricing, native edge distribution
  • Caching, sessions, rate limiting: Upstash Redis β€” nothing else matches it for serverless Redis
  • Kafka/messaging: Upstash Kafka β€” only serverless Kafka with HTTP API
Free Download

50 CLI Commands That Save Hours Every Week

The exact Git shortcuts, file search tricks, Docker commands, and productivity hacks that senior developers use daily. Compiled from 5+ years of shipping production code.

  • Git mastery (10 cmds)
  • File & search wizardry
  • Docker & DevOps tricks
  • Process & network tools
  • Productivity boosters
  • macOS & Linux install guide

No spam. 1 email/week max. Unsubscribe anytime.

Found this guide useful? Check out our free developer tools.