PGSimCity is an interactive 3D city that visualizes PostgreSQL internals, letting users explore mechanisms like shared buffers, WAL, and vacuum through a browser-based simulation.

Stars

180

7-day growth

No data

Forks

9

Open issues

2

License

Apache-2.0

Last updated

2026-07-27

Why it is worth attention

It reached #1 on Hacker News, offering a unique, visceral way to understand PostgreSQL internals without running a real database, with color-coded semantics and interactive scenarios.

Who it is for

  • Engineers new to database operations
  • Experienced developers wanting deeper PostgreSQL understanding
  • Database instructors seeking visual teaching aids
  • PostgreSQL enthusiasts curious about internal mechanics

Use cases

  • Learning how checkpoints cause latency spikes
  • Observing the effect of long-running transactions on bloat
  • Exploring WAL and replication behavior with slow replay
  • Teaching PostgreSQL internals in a classroom or workshop

Strengths

  • Interactive 3D visualization with semantic color coding
  • Guided tour and keyboard controls for easy exploration
  • No server, no database, no network calls – runs as a static bundle
  • Clearly states its limitations as a prototype and model, not an emulator

Considerations

  • It is a prototype (v0.1) with potential inaccuracies in simulation and explanations
  • Numbers are scaled for human observation, not real PostgreSQL scaling
  • Only simulates PostgreSQL behavior; no actual SQL execution or real query results

README quick start

PGSimCity

An explorable 3D city that shows how PostgreSQL actually works.

**Live: **

🍊 #1 on Hacker News — thanks to everyone who visited, and especially to those who filed corrections. Bug reports about PostgreSQL behaviour are the most valuable thing this project can receive; see the prototype note below.

Every building is a real mechanism. The plaza in the centre is shared_buffers — 1024 page frames whose height is their clock-sweep usage count and whose colour is their true state. The amber district to the east is the write-ahead log. The pit under the plaza is the data directory, and the heap files down there grow when you bloat them. To the south, a standby replays what the primary sends it, always a little behind.

It is built for engineers who are good at their job and have never had to operate a database — the people who need to understand why a checkpoint spikes latency, why one forgotten transaction bloats a table forever, and what synchronous_commit is really charging them.


This is a prototype (v0.1)

It was built quickly, and it almost certainly contains inaccuracies and mistakes — in the simulation as well as in the explanations. It is a model of PostgreSQL, not an emulator: no PostgreSQL source code runs here, and the numbers are scaled so a human can watch them.

If you spot something wrong, especially a claim about how PostgreSQL actually behaves, please open an issue or send a pull request. Corrections from people who know the engine are exactly what this needs.


A possible future

Today the city uses a hand-written simulation of PostgreSQL’s mechanisms, which is what makes internals such as the clock sweep’s frame-by-frame victim choice observable. A real PostgreSQL compiled to WebAssembly — PGlite and similar projects embed the actual engine — would make query results and plans authoritative, but could expose only what PostgreSQL exposes through catalogs, pg_stat_* views, and EXPLAIN, not those internal steps. They answer different questions; a future hybrid could let real execution and plans drive the modelled interior, but that is a direction rather than a promise.


Description

An explorable 3D city that shows how Postgres actually works

Related repositories

Similar projects matched by category, topics, and programming language.

0xwilliamortiz
Featured
0xwilliamortiz GitHub avatar

openclaude-improved

OpenClaude is an open-source CLI coding agent that runs on any platform and supports a wide range of LLM providers, offering the same tools and workflows as Claude Code.

AI & Machine LearningLarge Language Models
236
Blaizzy
Featured
Blaizzy GitHub avatar

nativ

Nativ is a native macOS app that lets you run AI models locally on Apple silicon, offering chat, model management, performance analytics, and an OpenAI/Anthropic-compatible API server.

AI & Machine LearningAI Agents
916
dboudreau00
Featured
dboudreau00 GitHub avatar

Conformiti

Conformiti is a self-hosted, open-source compliance management application that ships with full control libraries for SOC 2, ISO 27001, and PCI DSS v4.0.1, offering document lifecycle management, review reminders, role-based access, and an analytics dashboard.

Backend & APIsData & Databases
149