Baike.dev
All toolsOnline toolsAI codingTrendingOpen sourceNewsSubmit
Log in
< Back to tools
PGSimCity

PGSimCity

> DevOps
Free

An explorable 3D city that shows how Postgres actually works

740 stars0 likes4 views
WebsiteGitHub

About

An explorable 3D city that shows how Postgres actually works

PGSimCity

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

Start here: investigate a vacuum blockade

A table keeps growing even though autovacuum is running. Why?

  1. Open the city and choose Investigate. This starts the guided vacuum-blockade case.
  2. Inspect and record the table, worker, snapshot and application-owner evidence. Explain what prevents cleanup before choosing an intervention.
  3. End the transaction that the case establishes as abandoned, then check whether vacuum actually reclaims row versions. Releasing a snapshot is not itself cleanup.
  4. Choose Inspect a page and its row versions to connect the investigation to the page layout, tuple header and snapshot diagrams.

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.

Choose your view

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.

How much to trust this

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.


Press coverage

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

Further reading

  • Clement Mondary · Français: PGSIMCITY : comprendre PostgreSQL en visitant une ville en 3D — an introduction to the city’s visual language, interactive scenarios and distinction between the simulation and PGlite.

Articles describe the version available when published.


What you are looking at

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.


More things to try

  • Press T for the 14-chapter guided tour. It follows one connection from the client through planning, caching, WAL, checkpoints, vacuum and replication.
  • Press 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.
  • Run Cache thrash from the Scenarios menu. It sets 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.
  • Run The work_mem cliff. Its fixed Sort and HashAggregate nodes spill at 2 MiB, then fit at 4 MiB without replanning; the private reservoirs, base/pgsql_tmp, temp counters and latency breakdown show the consequence.
  • Turn on Long-running transaction. The xmin horizon blade sinks and goes red; autovacuum still travels to the tables, but reports zero removable rows while the sessions table keeps bloating. Release the transaction and cleanup can begin again.
  • Run Checkpoint storm. Watch the checkpointer's flywheel spin up, the fsync phase shudder, and a wall of full-page writes flood the WAL district after each checkpoint begins.
  • Set synchronous_commit to off and watch backends stop waiting in commit_wait. Then read what you just traded away.
  • Turn on Slow replay and watch sent_lsn, write_lsn, flush_lsn and replay_lsn pull apart on the standby.
  • Press 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.
  • Try an operator scenario, wait for its decision, and choose a response. Slot pressure, failover, and recovery make the consequence visible and offer a safe reset.

Controls

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.

Camera

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

Keys

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

WAL operations campaign

Choose Campaign, or open the required-standby case and the retired-consumer challenge. Opening preserves the city; **Reset city an

Issues· 0 open

View all issuesOpen on GitHub

No open issues yet, or sync has not completed.

> Tags

开发者工具

No comments yet. Be the first to share.

> Details

PublishedSep 9, 2026
UpdatedSep 17, 2026
CategoryDevOps
PricingFree

> Related tools

D
Docker
容器化平台,标准化应用交付
G
GitHub Actions
GitHub 原生 CI/CD 工作流
N
Nginx
高性能 Web 服务器与反向代理