PGSimCity 是一个可探索的 3D 城市,通过可视化方式展示 PostgreSQL 内部机制,让用户无需运行真实数据库即可理解共享缓冲区、WAL、清理等核心概念。

Stars

286

7 天增长

暂无数据

Fork 数

15

开放 Issue

3

开源协议

Apache-2.0

最近更新

2026-07-28

AI 仓库情报摘要
FR-AI / ANALYSIS

为什么值得关注

它在 Hacker News 上获得第一名,通过色彩编码和交互式场景,提供了一种独特且直观的学习 PostgreSQL 内部工作原理的方式。

适合谁使用

  • 刚接触数据库运维的工程师
  • 希望深入理解 PostgreSQL 的开发者
  • 寻找可视化教学工具的数据库教师
  • 对 PostgreSQL 内部机制感兴趣的爱好者

典型使用场景

  • 学习检查点如何导致延迟峰值
  • 观察长事务对表膨胀的影响
  • 通过慢回放探索 WAL 和复制行为
  • 在课堂或研讨会上教授 PostgreSQL 内部原理

项目优势

  • 交互式 3D 可视化,具有语义色彩编码
  • 提供导览和键盘控制,方便探索
  • 无需服务器、数据库或网络调用,作为静态包运行
  • 明确说明其原型(v0.1)和模型性质,并非模拟器

使用前须知

  • 原型阶段(v0.1),仿真和解释可能存在不准确
  • 数字经过缩放以适应人类观察,不代表真实 PostgreSQL 规模
  • 仅模拟 PostgreSQL 行为,无法执行实际 SQL 或返回真实查询结果

README 快速开始

PGSimCity

An explorable 3D city that shows how PostgreSQL actually works.

PGSimCity turns a PostgreSQL cluster into a city you can inspect, walk through, and break. It is for engineers who are good at their job and have never had to operate a database — the people who need to understand why a checkpoint spikes latency, why one forgotten transaction bloats a table forever, and what synchronous_commit is really charging them.

Explore the live city — no install required.

PGSimCity is an independent, non-commercial educational visualization of PostgreSQL internals. It is not affiliated with, sponsored, endorsed, or approved by Electronic Arts Inc. SimCity is a trademark of Electronic Arts Inc.

This project contains no SimCity code, assets, artwork, logos, characters, audio, or game content.


How much to trust this

PGSimCity is still 0.x: early and moving. It is a model of PostgreSQL, not an emulator: no PostgreSQL source code runs here, and the numbers are scaled so a human can watch them.

Three specialist review rounds checked PostgreSQL correctness against postgresql.org/docs and the source rather than memory; every finding was independently checked by a reviewer tasked with refuting it. A separate audit treated buildings, adjacencies, and animations as claims.

The suite has 234 tests; CI fails the build on a red test. They pin the WAL trigger point as max_wal_size / (1 + checkpoint_completion_target) at every call site, cache hit ratio as blks_hit / (blks_hit + blks_read), and the clock-sweep usage_count cap at 5.

Mistakes have been found and fixed throughout; the commit history records them. Known limitation: touch controls have been verified only in Chrome's mobile emulation. Corrections from people who know the engine are exactly what this needs: open an issue or send a pull request.


A possible future

The city uses a hand-written simulation of PostgreSQL’s mechanisms, which is what makes internals such as the clock sweep’s frame-by-frame victim choice observable. The separate Query flow offers an opt-in PGlite mode: real PostgreSQL supplies parsing, plans, catalogs, buffer counters, errors and results, while its plan drives the cl

项目描述

An explorable 3D city that shows how Postgres actually works

相关仓库与替代方案

根据分类、Topic 和编程语言匹配的相似项目。

TanStack
精选
TanStack GitHub avatar

router

TanStack Router is a type-safe, data-driven React router with built-in caching, prefetching, and nested layouts, while TanStack Start extends it into a full-stack SSR framework.

Web 开发前端框架
14,861
vercel-labs
精选
vercel-labs GitHub avatar

scriptc

scriptc compiles ordinary TypeScript into small, fast native executables without needing Node.js, V8, or any JavaScript runtime in the binary.

开发者工具代码质量与构建
1,985
Jakubantalik
精选
Jakubantalik GitHub avatar

thinking-orbs

A React component library that renders six hand-tuned animated thought orb loading indicators on a plain 2D canvas, with two purpose-tuned sizes and automatic theme detection for AI and agent UIs.

AI 与机器学习AI 智能体
1,191