Developer

PGSimCity Turns PostgreSQL 18 Internals Into an Interactive 3D City

PGSimCity, a new open-source tool by Nikolay Samokhvalov, visualizes PostgreSQL 18 internals as an interactive 3D city in the browser. It maps database components to districts, allowing developers and SREs to simulate operational pathologies like checkpoint storms and table bloat. Built with real PostgreSQL code via PGlite, it offers a hands-on way to understand query execution and system behavior.

Neura News

Neura News

Neura Market Editorial

August 16, 20264 min read
PGSimCity Turns PostgreSQL 18 Internals Into an Interactive 3D City

A new open-source tool called PGSimCity lets developers explore PostgreSQL cluster mechanics as a living, interactive 3D city. Released by developer Nikolay Samokhvalov, the educational visualization runs entirely in the browser with no local dependencies. It is accessible through the PGSimCity Live Visualisation sandbox, where users can watch queries flow through simulated streets, districts, and storage excavations.

The tool aims to bridge the gap between high-level SQL queries and low-level kernel execution. Its target audience includes backend developers, site reliability engineers, and database architects. The core abstraction maps PostgreSQL 18 internals to municipal districts, turning abstract processes into visible, spatial structures. Olimpiu Pop wrote about the release for InfoQ on Aug 16, 2026, detailing how the city metaphor makes complex database mechanics tangible.

A City Built From Database Internals

The simulation's districts are defined in src/world/layout.ts. Client connections enter from the north sky into the Postmaster supervisor, which forks worker processes along backend avenue. At the center sits the shared_buffers pool, a 1024-frame grid. Other central elements include wal_buffers, ProcArray, lock tables, and the Commit Log (CLOG).

Beneath the city, storage excavations represent heap data as 8 KB page fields, alongside B-trees, Free Space Maps (FSM), and Visibility Maps (VM). Write-Ahead Logging routes to the east WAL district, where walwriter and walsender threads broadcast replication streams. The western maintenance yard houses the checkpointer, bgwriter, and autovacuum workers. Each component occupies a place, making the entire lifecycle of a query visible.

Fidelity Through Decoupled Design

The presentation layer decouples three.js rendering from core state transitions. Simulation mutations are computed in isolated TypeScript state machines at src/sim/state.ts using SimState. This design choice ensures frame-rate fluctuations never desynchronize internal state. Backend developers can trace statement lifecycles through parse, rewrite, plan, and execute stages without losing accuracy.

Samokhvalov noted that the initial prototype was built through multi-billion-token LLM prompting. The prototype was then manually calibrated against the PostgreSQL REL_18_STABLE source code. That calibration process grounded the simulation in real behavior, not just visual metaphor. The result is a tool that does not merely illustrate concepts but simulates them with operational precision.

Simulating Real Operational Pathologies

The #1 Newsletter in AI

Stay ahead of the AI curve

The most important updates, news, and content — delivered weekly.

No spam. Unsubscribe anytime.

Principal database engineers and SREs can trigger operational pathologies to learn failure modes. Setting shared_buffers to 16 MB forces clock-sweep eviction races. In those races, backends write dirty victim pages before reading new data. Simulating a restricted work_mem causes Sort and HashAggregate execution nodes to spill temporary files into base/pgsql_tmp.

Long-running transactions depress the xmin horizon, starving autovacuum and inducing table bloat. Heavy write bursts trigger checkpoint storms that flood pg_wal with full-page writes (FPW). The FPW threshold is calculated as max_wal_size / (1 + checkpoint_completion_target). Each scenario gives users a safe space to see how PostgreSQL degrades under stress.

Community Feedback Shapes the Roadmap

The release sparked discussion on Hacker News about AI-assisted software architecture visualization and cognitive load. Community feedback led to a reduction in UI pop-up density, making the tool easier to read. That same feedback inspired a spin-off project called CHSimCity, aimed at ClickHouse, the column-oriented database management system.

PGSimCity incorporates PGlite to execute real, in-memory PostgreSQL compiled to WebAssembly in the browser's client thread. This means the simulation runs actual PostgreSQL code, not just a model of it. The project's ROADMAP.md outlines several core technical milestones. These include statement-pooling visualization modes, aligning the buffer-frame ring-sizing model with PostgreSQL 18's dynamic io_combine_limit and effective_io_concurrency rules, expanding interactive query plan paths, and implementing nightly mutation testing gates to harden the deterministic verification engine against the upstream REL_18_STABLE branch.

Licensing and Contribution

The full codebase, documentation, and operational test suites are available on the PGSimCity GitHub repository. The project is licensed under the Apache-2.0 License, a permissive open-source license. Developers are encouraged to provide feedback, fork, and contribute to the project.

The tool represents a shift in how database education can work. Instead of reading about buffer pools and WAL segments, developers can watch them operate in real time. The city metaphor turns invisible processes into something explorable. For teams debugging performance issues or learning PostgreSQL internals, PGSimCity offers a new way to see what is happening under the hood.

Related on Neura Market

More from Neura News

Industry

The Hidden Gold Rush: Scammers Exploit Demand for Claude Watermark Removal Apps

Anthropic's August 2026 watermarking of Claude text has sparked a surge in demand for removal apps, attracting scammers who peddle fraudulent tools. AI scientist Lance Eliot warns these apps often contain malware or fail to work, as statistical watermarks are nearly impossible to remove without heavy editing. With billions of users at risk, the problem is expected to worsen as more AI makers adopt watermarking.

Aug 16·12 min read
Product Launch

AWS Brings Native Vector Search to DynamoDB, Eliminating the Need for a Separate Vector Database

Amazon Web Services has introduced native vector search for DynamoDB, allowing developers to store embeddings and run approximate nearest-neighbor queries directly in the managed NoSQL database. This eliminates the need for a separate vector database and the data pipelines that kept systems in sync. The feature supports up to 4096 dimensions, offers multiple distance functions, and is available in all AWS regions.

Aug 16·4 min read
AI Models

One in Five US Workers Now Delegates Tasks to AI, Survey Finds

A new survey from Epoch AI and Ipsos reveals that 20% of employed US adults now delegate at least one work task to AI, with adoption varying by task – from 57% in software development to 25% in record-keeping. While AI often provides partial support, full task replacement remains rare, and time savings are reported in about half of cases when AI handles most of the work. The findings highlight a gradual redistribution of tasks rather than widespread job displacement.

Aug 16·5 min read