---
title: "Supavisor: Scaling Postgres to 1 Million Connections"
description: "Supavisor is a multi-tenant Postgres connection pooler written in Elixir that Supabase built to replace single-threaded PgBouncer."
url: "https://swe.quest/articles/supavisor-scaling-postgres-to-1-million-connections-8585e4b9712f0334"
canonical: "https://supabase.com/blog/supavisor-1-million"
source: "Supabase"
published: "2023-08-11"
difficulty: "medium"
kind: "Case study"
reading_minutes: 7
tags: ["postgres","elixir-erlang","scalability","multi-tenancy","performance"]
---

# Supavisor: Scaling Postgres to 1 Million Connections

A post on [Supabase](https://swe.quest/sources/supabase.md), published 2023-08-11, 7 min read, Case study. Original: [https://supabase.com/blog/supavisor-1-million](https://supabase.com/blog/supavisor-1-million)

## Summary

Supavisor is a multi-tenant Postgres connection pooler written in Elixir that Supabase built to replace single-threaded PgBouncer. In benchmarks one 16-core instance held 250,000 client connections over a 400-connection database pool, and a 64-core instance held 500,000. Two 64-core nodes, one connected to the database and one relaying through it, held 1,003,200 connections at 20,000 QPS. Median query latency was under 2ms at 5,000 QPS, but running the pooler as a separate cluster adds about 2ms per query compared with co-located PgBouncer, in exchange for not consuming the database server's CPU and RAM.

Written by swe.quest, not by the author.

**Difficulty:** Medium: assumes a working developer; shows how it is built or done

## Topics

- [PostgreSQL](https://swe.quest/tags/postgres.md) (Data & databases)
- [Elixir & Erlang](https://swe.quest/tags/elixir-erlang.md) (Languages)
- [Scaling](https://swe.quest/tags/scalability.md) (Distributed systems)
- [Multi-tenancy](https://swe.quest/tags/multi-tenancy.md) (Architecture & design)
- [Performance engineering](https://swe.quest/tags/performance.md) (Reliability & operations)

## Prerequisites

- Postgres connection model ([easy posts on PostgreSQL](https://swe.quest/tags/postgres.md?difficulty=easy))
- connection pooling basics

## Keywords

Supavisor, PgBouncer, Elixir, Supabase, k6, PostGIS

## Related posts

- [Supavisor 1.0: a scalable connection pooler for Postgres](https://swe.quest/articles/supavisor-1-0-a-scalable-connection-pooler-for-postgres-561015cc29e3cac0.md): Supabase · 2023-12-13 · Medium · 3 min read · PostgreSQL, Elixir & Erlang, Load balancing, Replication
  Supavisor 1.0, Supabase's Elixir-based Postgres connection pooler, is production-ready and adds query load balancing, named prepared statement support in transaction mode, and query cancelation.
- [PgBouncer is now available in Supabase](https://swe.quest/articles/pgbouncer-is-now-available-in-supabase-7611d240679e4c4c.md): Supabase · 2021-04-02 · Medium · 4 min read · PostgreSQL, Serverless, Scaling
  Supabase now bundles PgBouncer, co-located on the same server as each new project's Postgres, so serverless functions that open a connection per request don't overwhelm the database.
- [How we scale PgBouncer in ClickHouse Managed Postgres](https://swe.quest/articles/how-we-scale-pgbouncer-in-clickhouse-managed-postgres-130231ec324c9f46.md): ClickHouse · 2026-07-01 · Medium · 4 min read · PostgreSQL, Performance engineering, Load balancing, Linux, Scaling
  Because PgBouncer is single-threaded, ClickHouse Managed Postgres runs a fleet of PgBouncer processes sized to the core count, all binding one port via so\_reuseport so the kernel load-balances connections behind a single endpoint.
- [PGKeeper: Building the bouncer we needed for Postgres](https://swe.quest/articles/pgkeeper-building-the-bouncer-we-needed-for-postgres-b0a410376e101175.md): Figma · 2026-05-04 · Medium · 19 min read · PostgreSQL, Resilience, Go, Databases, Scaling
  Figma replaced PgBouncer with PGKeeper, a Go service built on PGX that sits between its DBProxy router and each Postgres instance.
- [How to Handle Database Connection Pooling](https://swe.quest/articles/how-to-handle-database-connection-pooling-1d65f2947c3645f4.md): Railway · 2024-12-13 · Medium · 13 min read · PostgreSQL, JavaScript, Performance engineering, Databases
  Connection pooling keeps a set of reusable database connections open, so requests check one out and return it instead of opening and closing a connection per query.

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)
