How PGSimCity Turns PostgreSQL Complexity Into a Virtual City 3D Simulation
| Source: InfoQ AI/ML
Tags: PostgreSQL, PGSimCity, database-visualization, three.js, educational-tools, developer-tools
PGSimCity visualizes PostgreSQL 18 internals as an interactive 3D city in the browser — client connections enter as traffic from the north, shared_buffers appear as a 1024-frame grid, and WAL operations map to an eastern district — giving backend engineers a spatial mental model of database mechanics.
Details
Nikolay Samokhvalov has released PGSimCity, an open-source browser-based educational tool that converts PostgreSQL 18 internals into a navigable 3D city simulation. Client connections enter the Postmaster supervisor from the north, which forks worker processes down a backend avenue. Shared_buffers appears as a 1024-frame grid, WAL operations route to an eastern district, and the maintenance yard houses autovacuum and bgwriter workers. The project strictly decouples the three.js rendering layer from TypeScript state machines at src/sim/state.ts, ensuring frame-rate fluctuations never desync internal state. Engineers can trigger real failure modes: setting shared_buffers to 16 MB forces clock-sweep eviction races, restricted work_mem causes Sort and HashAggregate nodes to spill to disk, and long transactions can starve autovacuum. The tool runs entirely in the browser with no local dependencies — accessible at the PGSimCity live sandbox. Samokhvalov noted on Hacker News that the initial prototype was built through LLM-assisted development before extensive manual refinement, making it an interesting real-world example of AI-assisted developer tooling. It is primarily an educational tool rather than a production monitoring solution, but its spatial metaphor for database internals could meaningfully accelerate onboarding for backend engineers and SREs.