<!-- mobian-agent-page publisher="dailydev" canonical="https://daily.dev/posts/how-pgsimcity-turns-postgresql-complexity-into-a-virtual-city-3d-simulation-hujsavfey" -->

---
title: How PGSimCity Turns PostgreSQL Complexity Into a Virtual...
description: Nikolay Samokhvalov released PGSimCity, an open-source browser-based 3D visualisation that maps PostgreSQL 18 cluster internals onto a virtual city, letting...
canonical: https://daily.dev/posts/how-pgsimcity-turns-postgresql-complexity-into-a-virtual-city-3d-simulation-hujsavfey
twitter:card: summary_large_image
twitter:site: @dailydotdev
og:type: website
og:site_name: daily.dev
og:title: How PGSimCity Turns PostgreSQL Complexity Into a Virtual City 3D Simulation | daily.dev
og:description: Nikolay Samokhvalov released PGSimCity, an open-source browser-based 3D visualisation that maps PostgreSQL 18 cluster internals onto a virtual city, letting...
og:url: https://daily.dev/posts/how-pgsimcity-turns-postgresql-complexity-into-a-virtual-city-3d-simulation-hujsavfey
og:image: https://api.daily.dev/og/posts/HUjsAvFEY.png
og:image:alt: How PGSimCity Turns PostgreSQL Complexity Into a Virtual City 3D Simulation
og:image:width: 1200
og:image:height: 630
og:locale: en
---

> ## Documentation Index
> Fetch the complete documentation index at: https://daily.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# How PGSimCity Turns PostgreSQL Complexity Into a Virtual City 3D Simulation

**[InfoQ](https://daily.dev/sources/infoq)** · 3 min read · 0 upvotes · 0 comments

## Summary

Nikolay Samokhvalov released PGSimCity, an open-source browser-based 3D visualisation that maps PostgreSQL 18 cluster internals onto a virtual city, letting backend developers, SREs, and database architects explore concepts like shared_buffers, WAL, autovacuum, and checkpoint storms interactively. Built with three.js for rendering and isolated TypeScript state machines for simulation logic, it uses PGlite to run a real WebAssembly-compiled Postgres instance client-side. Users can trigger pathologies such as small shared_buffers causing clock-sweep eviction, restricted work_mem causing temp file spills, and long transactions starving autovacuum. The project sparked Hacker News discussion on AI-assisted architecture visualisation, with the prototype built via heavy LLM prompting refined against Postgres source, and inspired a ClickHouse spin-off called CHSimCity. It's Apache-2.0 licensed and open for contributions, with a roadmap covering statement-pooling visualisation and alignment with io_combine_limit and effective_io_concurrency.

## Full article

daily.dev links to this article rather than hosting it. Read it at the original source: <https://www.infoq.com/news/2026/08/pgsimcity>

## Questions this post answers

### What is PGSimCity and how does it visualize PostgreSQL internals?

PGSimCity is an open-source browser-based 3D simulation that maps PostgreSQL 18 cluster mechanics onto a virtual city, with districts for the Postmaster, shared_buffers, WAL, and maintenance workers. It runs entirely client-side using three.js for rendering, isolated TypeScript state machines for simulation logic, and PGlite to execute real WebAssembly-compiled Postgres in the browser.

_Developers digging into database internals can follow tools like this via daily.dev alongside deeper PostgreSQL resources._

### How can I simulate buffer eviction problems or work_mem spills in PostgreSQL without a real cluster?

Setting shared_buffers to 16 MB in PGSimCity triggers clock-sweep eviction races where backends must write dirty victim pages before reading new data, and restricting work_mem causes Sort and HashAggregate nodes to spill temporary files into base/pgsql_tmp, both visualized interactively without needing a live PostgreSQL instance.

_Engineers troubleshooting memory tuning issues can track hands-on PostgreSQL tooling like this through daily.dev._

### What causes checkpoint storms and table bloat in PostgreSQL?

Long-running transactions depress the xmin horizon, starving autovacuum and causing table bloat, while heavy write bursts trigger checkpoint storms that flood pg_wal with full-page writes once the max_wal_size divided by one plus checkpoint_completion_target threshold is crossed. PGSimCity lets engineers trigger and observe these pathologies interactively to understand engine failure modes.

_SREs diagnosing production bloat and checkpoint issues can keep tabs on PostgreSQL deep dives via daily.dev._

---

Tags: [#open-source](https://daily.dev/tags/open-source), [#postgresql](https://daily.dev/tags/postgresql), [#data-visualization](https://daily.dev/tags/data-visualization), [#threejs](https://daily.dev/tags/threejs)

[View this post on daily.dev](https://daily.dev/posts/how-pgsimcity-turns-postgresql-complexity-into-a-virtual-city-3d-simulation-hujsavfey)

```json
{"@context":"https://schema.org","@graph":[{"@type":"Organization","@id":"https://daily.dev/#organization","name":"daily.dev","url":"https://daily.dev","logo":{"@type":"ImageObject","url":"https://daily.dev/apple-touch-icon.png","width":180,"height":180},"sameAs":["https://twitter.com/dailydotdev","https://github.com/dailydotdev","https://www.linkedin.com/company/daily-dev-ltd"]},{"@type":"WebSite","@id":"https://daily.dev/#website","url":"https://daily.dev","name":"daily.dev","publisher":{"@id":"https://daily.dev/#organization"},"potentialAction":{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https://daily.dev/search?q={search_term_string}"},"query-input":"required name=search_term_string"}}]}
{"@context":"https://schema.org","@type":"TechArticle","headline":"How PGSimCity Turns PostgreSQL Complexity Into a Virtual City 3D Simulation","url":"https://daily.dev/posts/how-pgsimcity-turns-postgresql-complexity-into-a-virtual-city-3d-simulation-hujsavfey","mainEntityOfPage":{"@type":"WebPage","@id":"https://daily.dev/posts/how-pgsimcity-turns-postgresql-complexity-into-a-virtual-city-3d-simulation-hujsavfey"},"datePublished":"2026-08-16T05:06:04.536Z","dateModified":"2026-09-14T08:57:05.261Z","description":"Nikolay Samokhvalov released PGSimCity, an open-source browser-based 3D visualisation that maps PostgreSQL 18 cluster internals onto a virtual city, letting...","image":"https://media.daily.dev/image/upload/f_auto,q_auto/v1/posts/85e80c27fb63fec74716828c0db48d92?_a=AQAEuop","thumbnailUrl":"https://media.daily.dev/image/upload/f_auto,q_auto/v1/posts/85e80c27fb63fec74716828c0db48d92?_a=AQAEuop","isAccessibleForFree":true,"articleSection":"InfoQ","inLanguage":"en","publisher":{"@type":"Organization","name":"daily.dev","url":"https://daily.dev","logo":{"@type":"ImageObject","url":"https://daily.dev/apple-touch-icon.png","width":180,"height":180}},"author":{"@type":"Organization","name":"InfoQ","logo":"https://media.daily.dev/image/upload/t_logo,f_auto/v1/logos/afc3bced3e1e4b188dd9127017a60e0c","url":"https://daily.dev/sources/infoq"},"commentCount":0,"discussionUrl":"https://daily.dev/posts/how-pgsimcity-turns-postgresql-complexity-into-a-virtual-city-3d-simulation-hujsavfey","interactionStatistic":[{"@type":"InteractionCounter","interactionType":{"@type":"LikeAction"},"userInteractionCount":0},{"@type":"InteractionCounter","interactionType":{"@type":"CommentAction"},"userInteractionCount":0}],"keywords":"open-source,postgresql,data-visualization,threejs","timeRequired":"PT3M"}
{"@context":"https://schema.org","@type":"BreadcrumbList","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https://daily.dev"},{"@type":"ListItem","position":2,"name":"InfoQ","item":"https://daily.dev/sources/infoq"},{"@type":"ListItem","position":3,"name":"How PGSimCity Turns PostgreSQL Complexity Into a Virtual City 3D Simulation"}]}
{"@context":"https://schema.org","@type":"FAQPage","@id":"https://daily.dev/posts/how-pgsimcity-turns-postgresql-complexity-into-a-virtual-city-3d-simulation-hujsavfey#faq","mainEntity":[{"@type":"Question","name":"What is PGSimCity and how does it visualize PostgreSQL internals?","acceptedAnswer":{"@type":"Answer","text":"PGSimCity is an open-source browser-based 3D simulation that maps PostgreSQL 18 cluster mechanics onto a virtual city, with districts for the Postmaster, shared_buffers, WAL, and maintenance workers. It runs entirely client-side using three.js for rendering, isolated TypeScript state machines for simulation logic, and PGlite to execute real WebAssembly-compiled Postgres in the browser. Developers digging into database internals can follow tools like this via daily.dev alongside deeper PostgreSQL resources."}},{"@type":"Question","name":"How can I simulate buffer eviction problems or work_mem spills in PostgreSQL without a real cluster?","acceptedAnswer":{"@type":"Answer","text":"Setting shared_buffers to 16 MB in PGSimCity triggers clock-sweep eviction races where backends must write dirty victim pages before reading new data, and restricting work_mem causes Sort and HashAggregate nodes to spill temporary files into base/pgsql_tmp, both visualized interactively without needing a live PostgreSQL instance. Engineers troubleshooting memory tuning issues can track hands-on PostgreSQL tooling like this through daily.dev."}},{"@type":"Question","name":"What causes checkpoint storms and table bloat in PostgreSQL?","acceptedAnswer":{"@type":"Answer","text":"Long-running transactions depress the xmin horizon, starving autovacuum and causing table bloat, while heavy write bursts trigger checkpoint storms that flood pg_wal with full-page writes once the max_wal_size divided by one plus checkpoint_completion_target threshold is crossed. PGSimCity lets engineers trigger and observe these pathologies interactively to understand engine failure modes. SREs diagnosing production bloat and checkpoint issues can keep tabs on PostgreSQL deep dives via daily.dev."}}]}
```

