Why you shouldn't do application-level sharding
Application-level sharding of an OLTP database looks simple on day one (a `shard_for(user_id % N)` function) but accumulates serious engineering burdens as a system grows.
Application-level sharding of an OLTP database looks simple on day one (a `shard_for(user_id % N)` function) but accumulates serious engineering burdens as a system grows.
Sentry Conventions is a superset of OpenTelemetry Semantic Conventions that defines attribute names, types, scrubbing policies, deprecation chains, span ops, span naming rules and metric specs across Sentry's ~100 SDKs, its Relay ingestion service, Snuba querying and the product UI.
PlanetScale's open-source Heroku Migrator moves multi-terabyte Postgres databases off Heroku standard plans, which lack WAL access and logical replication, by using Bucardo trigger-based replication: triggers record changes in delta tables, a one-time COPY loads existing data, and a worker replays the backlog before a controlled switchover with verification.
Turso Cloud's paid plans no longer meter active databases, so a database costs only its storage while idle.
Postgres ON DELETE CASCADE turns a single-row delete into an unbounded transaction that can cause outages at scale.
Supabase preview branches are separate projects that become ready in about 20 seconds (median) by running three mostly parallel workflows: copying configuration, applying migrations, and deploying Edge Functions.
Supabase replaced migra with pg-delta, its own open-source Postgres diff engine, as the generator behind declarative schema migrations in the Supabase CLI. pg-delta loads schema files and migration history into two shadow databases, diffs them by reading the system catalog, and orders output with a catalog-derived dependency graph.
Clera moved a 500 GB, 500+ table production Postgres database from the EU to the US overnight onto ClickHouse Managed Postgres, with production traffic still running, using two parallel ClickPipes pipelines.
A rollout of Railway's distributed routing control plane deployed a new routing service binary before its required database schema migration finished, because the two ran in parallel pipelines after the control plane was split out of the monolith.
Wix's large live-system migrations dropped from months or years to weeks mainly by tackling recurring problems before the migration starts, not through new tooling.
Storage version migration (SVM) is GA and enabled by default in Kubernetes v1.37, adding the built-in StorageVersionMigration API (storagemigration.k8s.io/v1) and a control-plane controller that rewrites stored objects to the current storage version.
Neon Labs launches with two experimental tools for major Postgres version upgrades on Neon, where pg_upgrade isn't supported and an upgrade means migrating into a new project.
The Neon CLI is renamed from neonctl to neon (old name kept as an alias) and gains a branch-first workflow built on `neon link`, `neon checkout` and `neon env pull`, which store project/branch context in a local .neon file and rewrite only Neon-managed env vars.
SQLite, especially via Turso Cloud, can replace PostgreSQL or MySQL for read-heavy, moderate-write workloads, trading complex-JOIN optimization, stored procedures, rich types and native replication for simpler operations, lower cost and local reads.
Cockroach Labs has made its CockroachDB Kubernetes Operator generally available.
Datadog migrated Stream Router, the control plane that tells metrics producers and queriers which Kafka cluster, topic and partitions to use, from a FoundationDB key-value model to a relational schema.
Spyne replaced a self-managed Debezium → Kafka → ClickHouse Kafka-engine/materialized-view CDC pipeline with ClickPipes on ClickHouse Cloud.
Open Electricity moved the analytical workload behind its public Australian energy API from Postgres/TimescaleDB to ClickHouse, keeping relational data in Postgres.
Palantir's Gotham document store rebuilds Elasticsearch indices from its transactional database (the source of truth) rather than using Elasticsearch's _reindex API, so search keeps serving live traffic throughout.
Slack replaced four conflicting desktop/mobile notification preference systems with one unified model that separates what to be notified about (All new posts, Mentions, Mute) from how notifications arrive (independent desktop and mobile push toggles).
PeerDB migrated a 1TB, 3.6-billion-row Postgres table in about 1 hour 50 minutes with 8 threads, compared with 8 hours 40 minutes for native logical replication and 17 hours for pg_dump/pg_restore.
Modem, a startup building an AI agent that centralizes user feedback from Slack, Discord and GitHub, uses Neon Postgres branching as its development workflow.
ClickPy, ClickHouse's free PyPI download analytics service, now holds over 2.2 trillion rows, and its cron-based ingestion script was replaced with ClickPipes without downtime.
Neon migrated thousands of user accounts and more than 10M projects from user ownership to organization (team) ownership with no downtime, no breaking API changes, no API key rotation and no customer action.
Serverless functions and container platforms differ in execution model, which changes how you handle deploys, database access, cron jobs, rollbacks and long-running work.
Running pgvector well depends on hosting that allows extension and configuration control, migrations wired into the deploy pipeline, and the right index choice.
Staging databases drift from production continuously in three ways: data drift (stale dumps, sequence values that diverge so the same ID points to different records), schema drift (hotfixes, skipped migrations, mismatched indexes and extensions causing query plan divergence), and transformation drift (anonymization that breaks uniqueness, referential integrity and determinism).
A schema migration adding a nullable column to a ~1 billion row PostgreSQL table stalled behind locks held by a long-running query.
Neon's copy-on-write storage makes Postgres database branches instant and cheap: each branch shares the parent's base data, gets its own autoscaling compute that scales to zero, and can be created from any point within the history retention window.
A snapshot-based workflow for promoting Postgres schema and data changes uses two isolated root branches, prod and dev, linked only through Neon snapshots.
Anything's Max coding agent gets a dedicated Neon database branch for every session, created in about 200 ms. The agent runs its migrations there and merges back into development atomically through Neon's restore API.
Datadog grew a single Postgres-to-search replication pipeline into a multi-tenant CDC platform built on Debezium, Kafka, and Kafka Connect.
A schema migration that added an indexed column to a ~1 billion-row Postgres table without `CREATE INDEX CONCURRENTLY` took an exclusive table lock, queuing nearly all backend API queries and taking down Railway's dashboard, CLI, Public API and GitHub webhook deploys for about 40 minutes.
Postgres 18 is available in preview on Neon's Free plan, and production upgrades should wait until it leaves preview.
A schema change removing an unused column was partially reverted by a later code change, breaking a core API and leaving Railway's project canvas stuck loading.
SQLite re-parses the entire sqlite_schema table after every ALTER TABLE, so schema changes cost time proportional to total schema size even when only one table is touched.
Six explicit Postgres rules, drawn from building the wispbit review bot, let an LLM code reviewer or coding agent catch common migration and query mistakes before production.
Separate Supabase projects for development and production, with all schema changes captured as timestamped SQL migrations in a Git-tracked supabase/ directory, keep a fast workflow from breaking live data.
Postgres event triggers, transactional DDL and LISTEN/NOTIFY can turn schema changes into reliable events that drive downstream automation such as SDK generation, warehouse syncs and documentation updates, with no external queue.
Hugging Face moved 500,000 repositories and about 20 PB from Git LFS to its Xet content-addressed storage with almost no user disruption.
ClickStack, ClickHouse's open-source observability stack, adds beta support for ClickHouse's native JSON column type for OpenTelemetry attribute columns in place of Map.
Neon now supports Postgres event triggers through the neon_superuser role, and they behave exactly as in vanilla Postgres.
Datadog is splitting its large shared Postgres database into independently owned instances through a three-phase plan: logical separation into per-domain private schemas with explicit ACLs, access reduction so only owning teams query their tables directly, and physical separation onto managed OrgStore instances.
Database-per-tenant schema migrations can scale to millions of databases by inverting control: a hosted schema registry stores a versioned catalog of SQL scripts, and each client periodically reports its schema version, pulls the missing migrations and applies them locally.
Postgres 17 is now available on Heroku Postgres, along with five new `heroku pg:upgrade:*` CLI subcommands (prepare, run, cancel, dryrun, wait) that expose Heroku's internal upgrade automation for self-service major-version upgrades.
Kami's Postgres event tracking (Rails writing JSONB rows, queried via Redash) collapsed when COVID pushed weekly events from about 80M to nearly 2B.
Squarespace migrated many PostgreSQL databases to CockroachDB without write downtime by streaming changes through a CDC pipeline: pgoutput logical decoding feeds per-table Debezium connectors into Kafka (Avro), and per-table Apache Beam pipelines on Dataflow upsert batched events into CRDB with checkpointing and backpressure.
SoundCloud's public API is deprecating its numeric `id` field because resource IDs for tracks, playlists, users and comments will soon exceed the 32-bit integer limit.
Supabase CLI now supports declarative schemas: the desired final state of Postgres tables, views, functions, RLS policies, grants and types lives in versioned .sql files, and a schema diff tool such as migra generates the migration files.
With Fauna sunsetting by the end of May 2025, a two-phase migration to Supabase keeps applications online.
With MongoDB's Data API and HTTPS Endpoints reaching end-of-life on September 30, 2025, Supabase's auto-generated PostgREST API is offered as a near drop-in REST replacement.
Nextdoor replaced pickle-style byte serialization of Django ORM objects in its Redis/Valkey look-aside cache with MessagePack, so cache entries stay readable across code releases and schema migrations.
Adding a UNIQUE constraint or setting a column NOT NULL in Postgres triggers a full table scan under an ACCESS EXCLUSIVE lock, which blocks all reads and writes and can take down an API on large tables.
Klarna migrated KRED, a 2004-era Erlang servicing system backed by a ~15 TB Mnesia database (1.3 TB in memory) replicated across 7 nodes, to Postgres with zero downtime.
Neon's Schema Diff feature now has a `compare_schema` API endpoint, available on all plans, that takes two Neon branch IDs and returns a unified diff of their Postgres schemas.
Benchling replaced its PostgreSQL entity-attribute-value (EAV) storage for schema field values with a single JSONB column per entity, cutting row counts and per-row overhead that had slowed automated assay-result ingestion.
Neon's Schema Diff GitHub Action compares the schema of a pull request's Neon child branch against its parent (or a specified base_branch) and posts the result as an SQL patch in a single PR comment.
Database-per-tenant setups need every tenant database kept on the same schema, and this walkthrough automates that across many Neon projects with DrizzleORM, the Neon API and GitHub Actions.
Drizzle ORM can be used from Deno via npm compatibility to get type-safe CRUD access to PostgreSQL.
Replit Agent can keep a Flask app's code and its Neon-hosted Postgres schema in sync by generating Alembic migrations from SQLAlchemy model changes, with a little prompting to use Alembic.
Deploying a full copy of the application and its own Neon Postgres project per customer is justified mainly by data residency requirements and by letting customers control upgrade timing, not by per-customer customization, which turns each deployment into a separate product.
A single shared application environment serving many per-customer Neon Postgres databases keeps deployment simple, but every tenant database must stay at the same schema version and data residency is hard to offer.
A database-per-user architecture on Neon usually means one Neon project per customer, and that quickly needs a control plane to manage onboarding, monitoring and schema upgrades across many projects.
Schema changes tested on Neon database branches can be promoted to an AWS RDS production Postgres database through GitHub Actions that run when a pull request merges.
Geni is a lightweight CLI that manages schema changes as paired up/down SQL files, applying each migration inside a transaction so a failed migration leaves the database unchanged.
MySQL's native INPLACE online DDL is unsuitable for non-blocking changes because it is resource-greedy, uninterruptible and blocks replicas, causing replication lag as long as the original ALTER.
Postgres has no separate users and groups, only roles: a role with LOGIN behaves like a user, and a role without it acts as a group whose privileges pass to its members through inheritance.
When a JSONB column's shape changes, a custom sql.Scanner and driver.Valuer on the Go column type can read both the old and new formats while always writing the new one. incident.io used this to move conditions from a flat array to an array of condition groups, which was needed to support OR logic.
Shepherd, an insurtech startup that moved its Alchemist pricing engine from SQLite to Postgres, uses Neon's copy-on-write database branches to give every pull request an ephemeral test database.
MySQL parses but silently ignores inline column-level `REFERENCES` clauses, so a foreign key written Postgres-style (`customer_id INT REFERENCES customers(customer_id) ON DELETE CASCADE`) creates no constraint, no index and no cascade behavior in MySQL.
Postgres id columns should be declared PRIMARY KEY rather than UNIQUE, because unique constraints permit multiple NULLs and do not automatically serve as the replica identity for logical replication.
Heroku migrated the time-series store behind MetaaS, its internal metrics service, from self-managed Apache Cassandra to AWS DynamoDB without user-visible impact.
Railway replaced direct per-variable calls to GCP KMS with envelope encryption: a locally generated AES-256-GCM data key per environment, encrypted once by KMS and serialized alongside each ciphertext.
A seemingly simple indexed join with LIMIT 1 ran for over four hours on Render's staging PostgreSQL, holding a lock that blocked CREATE OR REPLACE VIEW migrations and stalled deploys.
Atlas, an open-core Database Schema-as-Code tool, now supports ClickHouse, letting engineers declare the desired schema in a SQL file and have the tool inspect the live database, diff it, and generate the DDL migration plan automatically.
Moving a MySQL database to Turso takes three commands: dump it with mysqldump using --skip-extended-insert, convert the dump to a SQLite file with the mysql2sqlite script piped into sqlite3, then create a Turso database from that file with `turso db create --from-file`.
Prisma users on Neon can now use a single pooled Postgres connection string for both serverless queries and schema migrations, replacing separate pooled, direct and shadow database URLs.
Streamkap's ClickHouse connector streams change data capture from PostgreSQL, MySQL, SQL Server, Oracle and MongoDB into ClickHouse using Kafka, Debezium and Flink.
A database migration using `TRUNCATE TABLE ... CASCADE` on two new, unused tables silently wiped every production table with foreign keys to them, including issue and document descriptions, comments, notifications and reactions.
Shop app outgrew a single MySQL database despite federating tables across databases, so the team moved its Rails backend to Vitess, sharding user-owned tables by user_id into a "users" keyspace and keeping the rest in an unsharded "global" keyspace.
Supabase Branching gives each Git branch an isolated hosted Preview environment with its own Postgres database, Auth, Storage, Realtime, Edge Functions and APIs, plus separate credentials.
Postgres range partitioning can be retrofitted onto an existing "large table" (here, 500 million chat messages) without blocking queries by creating standalone daily child tables, bulk-loading them, adding a CHECK constraint that matches the partition range, and only then running ATTACH PARTITION so Postgres skips the validation scan and its blocking lock.
Neon shipped three changes to smooth Prisma integration: faster cold starts from scale-to-zero, simultaneous pooled (PgBouncer) and direct connection strings, and SQL-based role/database management that removes the need for a manual shadow database.
A step-by-step setup for a serverless TypeScript API on Cloudflare Workers that uses Hono for routing, Drizzle ORM for schema definition and migrations, and Neon serverless Postgres for storage.
Drizzle, Kysely, Prisma and Zapatos are compared as type-safe Postgres libraries for TypeScript across schema definition, query syntax, raw SQL support, migrations, edge-runtime support and community size.
ClickHouse 23.3 makes lightweight deletes (DELETE FROM with a row condition) generally available and the preferred way to remove data, and also adds trace visualization to the Grafana plugin and parallel replicas that split a shard's data across replicas.
Neon's copy-on-write branching can give every pull request its own production-like Postgres database, avoiding the bottlenecks of shared staging or shared preview databases.
Facing ~3x annual database traffic growth and 65% peak CPU on a single Amazon RDS Postgres instance, Figma chose vertical partitioning (moving groups of tables to their own databases) over horizontal sharding, NewSQL, or self-hosting.
Data model migrations can be made low-risk with a four-step playbook: create the new model, dual-write to old and new (backfilling dependent and existing data with rerunnable jobs), read from both and alert on mismatches before switching reads behind a feature flag, then stop writing to and drop the old model. incident.io walks through the pattern using its move from hard-coded string incident statuses to a per-organisation incident_statuses table.
Meta migrated its exabyte-scale analytics logging platform from legacy Hive Text Delimited and JSON serialization to the Tulip format across more than 30,000 logging schemas, sharply cutting bytes logged per second while schema counts stayed flat.
Tulip is Meta's binary serialization protocol for analytics logging, built on Thrift's TCompactProtocol.
GitHub migrated plaintext columns and columns encrypted with a deprecated internal library to ActiveRecord::Encryption.
Adding a NOT NULL column through LHM's shadow-table migration (new table, replication triggers, batched copy, rename) can break writes or silently lose data depending on the DEFAULT clause, an added UNIQUE INDEX and the MySQL SQL mode.
Supabase CLI v1 leaves beta with commands to manage organizations, projects and Edge Functions, plus database migration tooling, CI/CD workflows and TypeScript type generation.
Superology, a sports-betting product company, ingests clickstream and other customer quantitative data into ClickHouse straight from Kafka using the Kafka table engine with the Protobuf input format.
Instabug moved its mobile APM backend (about 3 billion events per day at roughly 2 million per minute) from Elasticsearch to self-managed ClickHouse after shard tuning and daily indexes failed to keep up with reads and writes.