---
title: "Scaling Nextdoor’s Datastores: Part 1"
description: "Nextdoor's Django/PostgreSQL backend outgrew the usual scaling fixes, and a move to distributed SQL was ruled out because multi-JOIN relational queries were spread across the codebase."
url: "https://swe.quest/articles/scaling-nextdoor-s-datastores-part-1-2e24faaf7f855796"
canonical: "https://engblog.nextdoor.com/scaling-nextdoors-datastores-part-1-234d0cf67665"
source: "Nextdoor Engineering"
published: "2025-03-19"
difficulty: "easy"
kind: "Case study"
reading_minutes: 5
tags: ["scalability","postgres","caching","replication","consistency"]
---

# Scaling Nextdoor’s Datastores: Part 1

A post on [Nextdoor Engineering](https://swe.quest/sources/nextdoor.md), published 2025-03-19, 5 min read, Case study. Original: [https://engblog.nextdoor.com/scaling-nextdoors-datastores-part-1-234d0cf67665](https://engblog.nextdoor.com/scaling-nextdoors-datastores-part-1-234d0cf67665)

## Summary

Nextdoor's Django/PostgreSQL backend outgrew the usual scaling fixes, and a move to distributed SQL was ruled out because multi-JOIN relational queries were spread across the codebase. A look-aside Redis cache, read replicas and splitting tables across databases by severing foreign keys each bought runway but brought their own problems. Those include uncacheable ORM queries, stale reads before writes, schema changes breaking cached data, and engineers defaulting to the primary. Partitioning also quietly broke atomicity for transactions that span databases. The team's 2024 goals are automatic routing of queries to replicas, cache fills from replicas, time-bounded eventual cache consistency and schema-tolerant cache serialization, which later parts of the series cover.

Written by swe.quest, not by the author.

**Difficulty:** Easy: no special background needed; explains what something is and why it matters

## Topics

- [Scaling](https://swe.quest/tags/scalability.md) (Distributed systems)
- [PostgreSQL](https://swe.quest/tags/postgres.md) (Data & databases)
- [Caching](https://swe.quest/tags/caching.md) (Backend & APIs)
- [Replication](https://swe.quest/tags/replication.md) (Distributed systems)
- [Consistency models](https://swe.quest/tags/consistency.md) (Distributed systems)

## Prerequisites

- relational databases ([easy posts on Databases](https://swe.quest/tags/databases.md?difficulty=easy))
- ORMs
- read replicas
- look-aside caching ([easy posts on Caching](https://swe.quest/tags/caching.md?difficulty=easy))

## Keywords

Django, PostgreSQL, Redis, Nextdoor

## Related posts

- [Scaling Nextdoor’s Datastores: Part 2](https://swe.quest/articles/scaling-nextdoor-s-datastores-part-2-3bede3a52d4cf43e.md): Nextdoor Engineering · 2025-03-19 · Medium · 4 min read · Replication, Consistency models, Databases, Scaling
  Letting product engineers manually choose replica vs. primary routing in Django broke down as abstractions hid read-after-write dependencies, and the common workaround of wrapping logic in transactions sent everything to the primary, slowly eroding the capacity gained from read replicas.
- [Scaling Nextdoor’s Datastores: Part 5](https://swe.quest/articles/scaling-nextdoor-s-datastores-part-5-9c2a55c33ba04857.md): Nextdoor Engineering · 2025-03-19 · Medium · 8 min read · Caching, Consistency models, Event-driven architecture, PostgreSQL, Scaling
  Nextdoor closes cache consistency gaps in its look-aside Redis cache by consuming the PostgreSQL change data stream and issuing version-conditional del\_if\_version deletes whenever writers fail to update the cache.
- [The architecture of Neki](https://swe.quest/articles/the-architecture-of-neki-b0a20bdb70a4c3cd.md): PlanetScale · 2026-09-18 · Medium · 9 min read · PostgreSQL, Distributed databases, Replication, System design, Kubernetes
  Neki shards unmodified PostgreSQL behind a single connection string.
- [How Figma’s databases team lived to tell the scale](https://swe.quest/articles/how-figma-s-databases-team-lived-to-tell-the-scale-5117114294b188fe.md): Figma · 2024-03-14 · Medium · 19 min read · PostgreSQL, Distributed databases, Scaling, Query engines
  Figma horizontally sharded its RDS Postgres stack after vertical partitioning ran out of room.
- [You should shard your database](https://swe.quest/articles/you-should-shard-your-database-12cdc70ed1f6d2d7.md): PgDog · 2025-11-13 · Medium · 7 min read · PostgreSQL, Distributed databases, Scaling, Query engines
  Sharding Postgres early avoids the operational pain of large single instances, illustrated by an outage where stale planner statistics caused a 300 GB table to be sequentially scanned.

Browse: [Latest posts](https://swe.quest/index.md) · [Topics](https://swe.quest/tags.md) · [Sources](https://swe.quest/sources.md) · [Topic map](https://swe.quest/map.md) · [Site guide (llms.txt)](https://swe.quest/llms.txt)
