
An explorable 3D city that shows how Postgres actually works
An explorable 3D city that shows how Postgres actually works
Walk through PostgreSQL. Break things. Understand why.
An explorable 3D city where buildings represent PostgreSQL internals and motion shows their interaction. Follow a query, investigate a growing table, or see what changes when memory, checkpoints and replication become bottlenecks.
Explore the city · Start an investigation
No installation. Runs in a browser with WebGL2. Featured in InfoQ · IBM Think · Gizmodo · GIGAZINE
A table keeps growing even though autovacuum is running. Why?
Pause when you need time to read. Try challenge mode afterward for less guidance. Evidence and notes belong to the current attempt; they do not survive a reload.
| Experience | What you can do |
|---|---|
| City | Explore the engine spatially, follow the guided tour and investigate a vacuum incident. |
| Diagnose | Follow a query’s path and inspect the simulation through a 2D diagnostic interface. |
| Machine | Run real SQL with opt-in PGlite beside a 2D architecture board; measured and modeled values are labeled separately. |
The city is a model, not a running PostgreSQL server. Its numbers and timing are scaled to make internals observable. The separate Machine and opt-in Query flow can execute real PostgreSQL through PGlite; they do not turn the city into a production monitor.
The project is an evolving 0.x prototype, with known simplifications and tests against PostgreSQL behavior. See model accuracy and limitations for the reviewed reference version, formulas and review history.
PGSimCity targets the PostgreSQL 18 major line, with PostgreSQL 18.6 as its
reviewed reference and REL_18_STABLE
as the source branch. Four review rounds are documented in the accuracy notes;
they do not establish complete coverage or make this model an emulator.
Report a PostgreSQL mismatch.
Lessons include keyboard and text-first routes; the 3D scene and first-person walk do not have a nonvisual equivalent. Touch verification has used browser emulation, not physical devices. Accessibility and alternatives.
Featured in InfoQ, IBM Think, Gizmodo and GIGAZINE.
Selected reporting and hands-on reviews of PGSimCity:
| Publication | Article | Published |
|---|---|---|
| InfoQ | How PGSimCity Turns PostgreSQL Complexity into a Virtual City 3D Simulation — Olimpiu Pop on the project’s architecture and educational approach. Also available in 简体中文, translated by 田橙. | August 16, 2026 |
| IBM Think | Someone turned PostgreSQL into a city you can walk around in — Antonia Davison’s feature, also included in the IBM Think newsletter. | July 31, 2026 |
| Gizmodo | This SimCity-Like Visualization Turns Tech’s Most Boring Systems Into Fun — Tom Hawking’s hands-on review. | July 28, 2026 |
| GIGAZINE | データベース「PostgreSQL」がどのように実際には内部で動いているかがシムシティっぽい3Dでわかる「PGSimCity」 — a screenshot-led Japanese walkthrough of connections, query planning, buffers, page storage, WAL, vacuum and replication. English edition. | July 28, 2026 |
Articles describe the version available when published.
| District | What it is |
|---|---|
| Client sky (north, above) | Connections arriving from the application tier |
| Postmaster | The supervisor. Forks one backend per connection and never touches your data |
| Backend row | 16 backend processes. Their lighting is their state — including idle in transaction |
Buffer pool (shared_buffers) |
Up to 1,024 representative frames (256 active at the 2 GiB model default; PostgreSQL 18 defaults to 128 MiB), beside wal_buffers, the ProcArray, lock table, CLOG and buffer mapping table |
| The excavation | The data directory: where memory ends and storage begins |
| Storage (below) | Heap files as fields of 8 KiB pages, B-trees as actual trees, TOAST, the FSM and visibility map, the OS page cache and the disks |
| WAL district (east) | Backends and walwriter write WAL into pg_wal; the archiver copies completed segments, while walsenders independently stream WAL as it is generated |
| Maintenance yard (west) | Checkpointer, background writer, autovacuum launcher and its workers |
| Standbys (south) | Two independent walreceivers, startup processes replaying WAL, and the lag on each stream |
| Continuity quarter (outer east and south) | WAL archive, base backups, point-in-time recovery, delayed replay, leader lease and rejoin machinery |
| Query lab (above the backends) | Select a backend and its statement unfolds: parse → rewrite → plan → execute |
PostgreSQL 18's bulk-read strategy grows with
io_combine_limit × effective_io_concurrency, subject to caps. This city's animation uses a fixed 32-frame ring instead; it is a historical simplification, not PostgreSQL 18's sizing rule. Model accuracy and source reference.
Colour is semantic everywhere and never decorative: WAL is amber, dirty pages are red, clean pages are blue, vacuum is violet, checkpoints are pink, the background writer is teal, replication is orange, storage is green, indexes are aqua, locks are red.
T for the 14-chapter guided tour. It follows one connection from
the client through planning, caching, WAL, checkpoints, vacuum and replication.Enter to trace one statement. Pick Non-HOT UPDATE and slow
playback exposes where it enters the buffer pool, creates WAL and waits to
commit.shared_buffers to
16 MiB — below the manual control's 128 MiB minimum — so the clock sweep races
and backends write their own dirty victims before they can read another page.base/pgsql_tmp, temp counters and latency breakdown show the consequence.sessions table keeps bloating. Release the transaction and cleanup
can begin again.synchronous_commit to off and watch backends stop waiting in
commit_wait. Then read what you just traded away.sent_lsn, write_lsn, flush_lsn and
replay_lsn pull apart on the standby.G and walk through the city at eye level. A buffer frame that read
as one tile from the establishing shot becomes a structure above your head.
Press E at the autovacuum lever or the postmaster door to operate it;
the control center inside can trace one of six statements across a map of the city.Start with drag to pan, wheel/pinch to zoom, T for the tour, K to pause and H to return to the overview.
All camera controls and keyboard shortcuts
Press ? in the city for the city control map and colour legend.
| Input | Action |
|---|---|
| Left-drag | Pan in orbit mode — grab the ground and move it, the way a map does |
Shift-left-drag or Ctrl/Cmd-left-drag |
Orbit around the city |
| Middle-drag | Pan in orbit mode |
| Right-click or touch long-press | Open the context menu |
| Wheel | Zoom towards the cursor in orbit mode · adjust movement speed in fly mode |
| 1 finger | Pan in orbit mode |
| 2 fingers | Pinch to zoom · twist to orbit · drag both up/down to tilt |
| First-person touch | Left thumb moves · right thumb looks · buttons jump and crouch (rise and dive while swimming) |
| Click | Select a building · in fly or walk mode, capture the mouse for looking |
| Double-click | Focus a component — semantic focus instead of a map-style zoom step |
W A S D or the arrow keys |
Move |
Shift + left/right arrow |
Turn left/right in orbit, fly, or walk mode |
Shift + up/down arrow |
Tilt or look up/down in orbit, fly, or walk mode |
+ / - |
Zoom in/out in orbit mode |
Space or E · C or Q |
Rise · descend in fly mode; in walk mode, Space jumps, E operates nearby levers, doors, or consoles, and C crouches |
PageUp / PageDown |
Change altitude in orbit or fly mode |
Shift · Alt |
Boost · precision in orbit or fly mode; Shift runs in walk mode |
Esc |
Leave pointer lock |
| Key | Action |
|---|---|
F |
Toggle fly / orbit camera |
G |
Get down and walk the city on foot, 1.7 m tall |
H |
Back to the establishing shot |
Home |
Back to the default establishing shot |
O |
Straight-down overview of the whole plate |
T |
Guided tour — the core query and maintenance path in 14 chapters |
Enter |
Open Run a Query |
/ or Ctrl/Cmd+K |
Command palette — search every component, setting and scenario |
? |
Keyboard map and colour legend |
L |
Toggle the floating labels |
N |
Cycle night / afternoon daylight / approximate local-time light |
M |
Toggle walk sound |
K or P |
Pause / resume |
Focus +0.1 model s, then Enter |
Advance the paused workload by 0.1 model seconds; remain paused |
, . |
Slower / faster (0.1× – 5×) |
R |
Reset to the default settings |
Esc |
Close the topmost overlay |
1 – 8 |
Jump to a district: clients, backends, buffer pool, WAL, storage, query lab, maintenance, standby |
Choose Campaign, or open the required-standby case and the retired-consumer challenge. Opening preserves the city; **Reset city an
No open issues yet, or sync has not completed.