PGSimCity - How PostgreSQL Works
875 points by jonbaer 22 hours ago | 85 comments

layoric 21 hours ago
I love what is trying to be done here. Some feedback to improve would be to cut out a lot of the noise with the "Take tour". There are too many boxes and things changing on the screen to get a sense of what is happening. Also make it interactive rather than automatically switch onto the next subject. Being a passive observer to so much information trying to be conveyed is very confusing.

I really do like these kinds of approaches to showing the inner workings of different kinds of tech, so think this is on the good path to being a very useful tool, but needs some focus rather than more data/graphs/info boxes.

reply
titzer 21 hours ago
It's amazing 3D going on, and then 80% of the visual space is popups that completely block it. It'd be have a nice prominent ways of reducing the noise, and that pops were partially transparent.
reply
npl 20 hours ago
Yea on mobile especially
reply
samokhvalov 19 hours ago
I hear you. WIP!

thanks for all the feedback. It's amazing for me too. It all started yesterday with a single prompt and curiosity what Opus 5 can do.

~3.86B tokens used so far (not counting GPT 5.6 Sol that at some point started to do a lot of legwork for coding)

reply
svobodamartin 2 hours ago
3.8B tokens, really Billions?

In my case token consumption per week of kinda intense 3 simultaneous projects coding half of the day on Max20 is 55M tokens.

Where do the extra ~2 orders of magnitude come from?

reply
nugator 12 hours ago
~3.86B * $5/M tokens ≈ $19.3k

Is that the cost you've payed for this or is my calculation completely wrong?

reply
hectormalot 9 hours ago
Likely a lot of those tokens are cached. And because it’s an individual project it’s likely this is under a personal Claude Max 20x plan.
reply
samokhvalov 7 hours ago
correct on both counts
reply
saransh12345 15 hours ago
Share the prompt here please?
reply
samokhvalov 7 hours ago
it was silly, quick check out of curiosity what Opus 5 can do – and the first thing I saw was so impressive that it made me spend hours during weekend polishing it

here it is from history, without edits

> you're a veteran Postgres hacker and expert. I want 3D visualization of how Postgres works, for browser -- all its major components, presented as a 3d model, complex, with all parts zoomable, and animated, with controls -- checkpointer, bgwriter, autovacuum, walwriter, backends, walsender, etc etc etc. Imagine we need to build a 3d model of whole city. That's same level. We need this so engineers who are non-DB-experts would easily understand how it works. Design must be cool, modern, super cool, running all in browser, with controls, with camera position flying with arrow keys and mouse, zoomable, etc. Think deep how to implement it, which modern cool tech to use, and use ultracode to implement in a new directory (we'll commit it later). OK to use the most cool and most modern stuff. Think deep choose tools wisely and let's build an awesome in-browser 3d model of Postgres engine

(later I came with lots of materials about internals and behavior and we started to polish / improve)

reply
npl 5 hours ago
I frequently have asked Claude to explain different software architecture things that I don’t know because I’m not formally technically trained - like “explain Django as though it’s a city with different parts having different roles”. I’m a visual learner so this helps a lot and gives me ideas for how to have similar visualizing for other stuff at various levels of abstraction.
reply
yieldcrv 19 hours ago
single prompt Claude Design before putting it in Claude Code
reply
derac 15 hours ago
maybe try adding tts to the tour?
reply
andyfilms1 19 hours ago
This is good general advice. If your software needs a "tour," that's a good indicator you should work on your UX instead. If you're just excited to tell the user about a new feature, they'll discover it when they need it.
reply
appplication 19 hours ago
I think in this case a tour is fine and sort of the point. But I disagree with you generally.
reply
vixen99 16 hours ago
Not everyone will come to view this model from the same vantage point. Some will simply be curious about some famous software that they don't happen to use. So the tour is an excellent idea. Great presentation. Congratulations.
reply
narmiouh 21 hours ago
I imagined as soon I saw the initial visual that I would somehow be able to enter a query and it would walk me through the flow through the entire system starting from input parsing to all the way to delivering output and perhaps along the way understand some of the autonomous processes that happen in parallel that aren't query specific but run constantly.

What others are saying - fantastic attempt, but don't know where to start or where to end.

reply
samokhvalov 18 hours ago
try pressing T
reply
INTPenis 14 hours ago
How to rotate camera?
reply
justinclift 12 hours ago
If you're using a keyboard and mouse, then SHIFT + left mouse button seems to work.
reply
narmiouh 9 hours ago
That's fantastic, please tell me I was short sighted and missed this when I wrote my comment.
reply
samokhvalov 7 hours ago
yeah, it was there before your comment; maybe not easy to find (help is on "?", which is also maybe not easy to find)
reply
Curtis_Guan 21 hours ago
Understanding how scheduling works inside a database used to require numerous architecture diagrams to explain. I was amazed when I saw PGSimCity — it presents such a complex technical implementation process in such an engaging way. Since it's already open‑source, I think the same idea can be reused in other domains, such as cloud computing, Kubernetes, and so on.
reply
tptacek 20 hours ago
I've always wanted to do an explainer of the deployment system and state-tracking at Fly.io using Factorio as a visual metaphor.
reply
inigyou 11 hours ago
Let's make a Factorio overhaul mod where your goal is to produce fly.io deployments!

Bonus if it actually deploys on fly.io. This is not possible with a mod alone.

reply
MitziMoto 20 hours ago
I heard you have some free time now, so let's see it!
reply
robertlagrant 12 hours ago
I keep wanting to build a Kubernetes visualiser. I know they exist, but the last time I looked they didn't look that great.
reply
willquack 10 hours ago
This is very similar to what I imagine whenever I get into a deep focus state debugging a program in gdb... I would love to experience debugging a program in VR with graphics like this,,, there would be no better way to learn a codebase. I wonder how good an experience you could achieve by generating a 3d map based on arbitrary code
reply
notachatbot123 15 hours ago
Considering that it has been vibe-coded with not even 48 hours passed: Is this truthful and accurate at all? Or will it lead to false conclusions and anti-knowledge?
reply
parthdesai 6 hours ago
Not entirely sure, but the person vibe coding this does know Postgres really well tbf
reply
itomato 11 hours ago
Glean anything or learn something in particular?

This is a brutalist gew-gah.

reply
stronglikedan 5 hours ago
Nit, but there's no dash in gewgah.
reply
fragmede 14 hours ago
LLMs aren't that bad anymore.
reply
INTPenis 11 hours ago
Like any tool they're as good as the wielder.
reply
stronglikedan 5 hours ago
Except most tools aren't constantly improving exponentially.
reply
youre-wrong3 14 hours ago
[dead]
reply
arjie 20 hours ago
I can't believe "Rendering The First Frame..." is not "Reticulating Splines..." :)

Cool UI.

reply
seeken 2 hours ago
This is really cool to look at. A couple weeks ago I started vibe-coding a Doom for Beam which will allow you to 'run around' a beam VM as a factory floor and see the modules and functions, how they are connected, how 'hot' they are running, and whether they're throwing sparks. I haven't gotten far yet, but I've been wanting to build it to justify getting myself a VR headset.
reply
jedberg 18 hours ago
I have a pretty good working knowledge of the internals of Postgres, but this just confused me. I think it's too busy to understand. At the very least, it would be cool if there were a "slow down" button.
reply
augunrik 18 hours ago
There are buttons on the bottom left: pause and two to adjust the speed (down to 0.1x). Some parts of the city can be adjusted when you click on it (I just found the transactions/s)
reply
jedberg 18 hours ago
Ah indeed there is. Totally didn't notice that, thanks.

But even at .1x it's too quick. :) I should be able to fire individual transactions and watch them flow.

reply
chrisweekly 7 hours ago
yeah, interactivity would be next-level (as several others in these threads have mentioned)
reply
WiSaGaN 11 hours ago
I assume this is done with the help of AI? I have done similar vibe project that explaining catastrophic forgetting with the help of AI. It's just so satisfying now that if you really want to learn something, you can always do it with the help of AI. Before, it's hard to find good resources, now it's not a problem, the issue now becomes one's own focus and agency.
reply
dostick 20 hours ago
It surely is impressive,but it’s just that - components of db service as buildings/machine. What it needs is narrative, purpose, with main actors clearly defined - client and data. demonstrating what is involved in the chain when data’s written and requested.
reply
computomatic 20 hours ago
Try the tour. It’s exactly that.
reply
samokhvalov 18 hours ago
yep (via pressing T)

but I agree, could be better – thinking

reply
loveparade 21 hours ago
I don't know what I am looking at but it is fabulous.
reply
dbgrman 5 hours ago
At first sight, it looks super cool. Kudos for pulling this off. At closer look, feels very overwhelming. The claude tone doesn't help ease the nerves either. The text version is too verbose.
reply
getfluxly 17 hours ago
It's a cool and very educative way to learn. But I wish there's like a live query thing going on so that it'd be easy to understand. I am viewing on the 27" 4K screen and it's perfect for it, like others said, I don't feel there's too much boxes and info at the same time. Although the site is going blank sometimes if I zoom in a bit too much. Really cool nonetheless.
reply
citizenpaul 5 hours ago
> I wish there's like a live query thing

There is. "Run a query" at the top nav bar.

reply
thelastgallon 7 hours ago
I wonder if games can be developed to teach CS (OS, db, compilers) which are visual. Instead of reading a book on databases, perhaps tinkering with something like this would make learning easier. (I'm not a gamer, but I read about factorio kind of games on hn).
reply
xerox13ster 32 minutes ago
Turing Complete taught me how to build a computer and how assembly programming works to the point that I was able to “hackerman” a trivial program on my own ISA in binary.
reply
npunt 20 hours ago
This is very cool, just some UX tips to make it more legible:

1. remove ~50% of the UI since it covers too much of a laptop screen

2. improve the camera controls so its easier to pan and zoom.

reply
samayashar 15 hours ago
Virtually it's so amazing to see. The layers are clearly separated and it does give a sense of the connections being accepted and processed in the central part.

The operation intricacies are a bit difficult to understand because the core looks a bit clogged up. Nonetheless, great work!

reply
futurecat 15 hours ago
Bravo! I have worked in observability for years and I have a deep desire for new visualizations technics inspired by video games. It would be great in XR as well.
reply
itomato 11 hours ago
Jira professional here, and OpenRCT2 has been my mental (and my agent’s) model for something similar.
reply
skreem 21 hours ago
This is really cool, I like having visualization to hold on my head!

Also (assuming this is LLM-generated, apologies if it’s not) seems like the future of learning/self-teaching… gonna try and generate similar things for stuff I’m learning

reply
smhaziq 20 hours ago
it is in the commit 'Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>'
reply
harvie 9 hours ago
We've got GPU accelerated PostgreSQL sooner than GTA VI...
reply
robertlagrant 12 hours ago
I would love this as an active visualisation of a live postgres. Imagine monitors with this stuff on, including replication from other postgresses, and whatever pgbouncer is doing on the front.
reply
manytimesaway 19 hours ago
Besides the sadly obvious vibe-coding, just note that SimCity is still an active trademark from EA, so might be good to rename it.
reply
DonHopkins 13 hours ago
Good point! To respect EA's trademark and the terms of their modifications to the GPL-3 license regarding the use of their SimCity trademark, I renamed the open source version of SimCity to Micropolis, which was its original working title. It would be safe to call this project "PGMicropolis" as long as it wasn't for profit.

At the time, there was a disk drive manufacturer by that name, so Will Wright renamed it SimCity.

Fortunately the guy who now owns the rights to the Micropolis trademark (and is an old school hacker who really gets it) was kind enough to allow us to use the name for non commercial purposes, under the Micropolis Public Name License.

https://github.com/SimHacker/MicropolisCore/blob/main/Microp...

Here's the explanation from the MicropolisCore repo's LICENSE file:

https://github.com/SimHacker/MicropolisCore/blob/main/LICENS...

>MICROPOLIS LICENSING

>The Micropolis project operates under two important licenses:

>1. The Micropolis GPL License Notice - This is the GNU General Public License with additional terms added by Electronic Arts to protect the SimCity trademark while allowing the code to be freely used and modified.

>2. The Micropolis Public Name License - This license governs the use of the "Micropolis" name itself, which is a registered trademark of Micropolis Corporation.

>We extend our sincere gratitude to Electronic Arts <https://www.ea.com> for their generosity in releasing the SimCity source code under an open-source license, and to Micropolis Corporation <https://www.micropolis.com> for allowing the community to use the Micropolis name for this open-source city simulation project. Please respect both Electronic Arts' SimCity trademark and Micropolis Corporation's Micropolis trademark by adhering to the terms of these licenses. Additionally, we ask all users to please honor the terms of the <https://www.gnu.org/licenses/gpl-3.0.html> GNU General Public License v3, which protects the freedoms that allow this project to exist and thrive as open-source software.

More details, and another cautionary tale about accidentally getting sued for trademark infringement:

https://news.ycombinator.com/item?id=46981012

>This matters more than people think. Jeff Braun, CEO of Maxis, told me this story:

>"Maxis was sued by Toho. We never referred to the name Godzilla, our monster on the box cover was a T-Rex looking character, but... a few magazine reviews called the monster, Godzilla. That was all it took. Toho called it 'confusion in the marketplace'. We paid $50k for Godzilla to go away. In all honesty, Toho liked Maxis, they said $50k was the minimum they take for Godzilla infringement."

>So please: call the game Micropolis, not SimCity, or EA's lawyers may come knocking. And unlike Toho, EA and their Saudi investors and Jarod Kushner might want to use their bone saws on you, which are much worse than Godzilla.

If any busy-body lawyers find this thread and actually want to go after someone's who's disparaging their trademark, they should look into this instead of open source projects:

https://news.ycombinator.com/item?id=43952567

>I let the domain "micropolisonline.com" expire, which I was using for the old OpenLaszlo/Flash Python/SWIG/C++ client/server based version of open source SimCity, and somebody took it over and replaced it with AI generated claptrap, stealing a lot of my own and other's images without any credit. It even promises the source code, but doesn't actually link to it, just has promises and placeholders.

>It totally misrepresents what Micropolis is, which was based on the original SimCity classic, and confuses it with all the subsequent versions of SimCity and other made-up stuff. And it never mentions the GPL-3 license, EA's license and restrictions on the use of their SimCity trademark, or Micropolis's license to use their trademark. I have no idea what the point of it is.

Here's some more interesting stuff about applying machine learning and LLMs to Micropolis:

https://news.ycombinator.com/item?id=46981043

>Sam Earle's fractal neural network approach (https://arxiv.org/pdf/2002.03896) is exactly this kind of thing. His key trick: recursive weight-sharing in fractal convolutional blocks, so each column of the network acts as a continuous-valued cellular automaton ticking different numbers of times. The deepest column gets a 33x33 receptive field -- enough to connect power across an entire 32x32 map in one forward pass.

>The agents discovered power-plant + residential pairing, road placement for density, zone clustering by type, and traffic-avoiding road layouts. When stuck at local optima, a human player could intervene (deleting power plants) to force re-exploration -- and the agent would improve its design.

>The paper was 2019, before LLMs were doing this kind of thing. Different paradigm (RL on tile grids vs. LLMs on coordinate text), same hard problem.

https://news.ycombinator.com/item?id=46981059

>Sam Earle did exactly this with RL agents trained via quality-diversity methods on Micropolis:

https://github.com/smearle/gym-city

>[...] Here's more about my plans for making a multi player version of Micropolis with time travel, branching, and merging, by using github as a social network and MMPORG platform (when it's not down ;):

https://github.com/SimHacker/moollm/blob/main/designs/sims/s...

reply
laurentiurad 15 hours ago
how do you know it has been vibe-coded? And why does it matter?
reply
j1436go 15 hours ago
Because it reduces my trust in the truthfulness of the represented information.
reply
laurentiurad 14 hours ago
but how can you know the author used AI in the first place, and more than that, if he indeed did it, that he didn't check what the LLM did?
reply
bspammer 14 hours ago
The AI generated text in the tour is a good clue. But I also don’t think the author is denying it.
reply
johnhamlin 8 hours ago
UI looks great on a 32" monitor, idk what everyone's complaining about ;)
reply
antoinetouss 15 hours ago
I love this, let's do all of Data Intensive Application SimCity!
reply
num42 20 hours ago
Really great work! I've always wanted to build a CPU simulator(Full PC simulator) in this style. I still haven't fully figured out my own approach, but this will definitely be an inspiration for me. Thanks for making and sharing it.
reply
gregsadetsky 20 hours ago
Great work! When zooming out a bit, I'm somewhat sure that the 'blinking'/glitching is due to z-fighting. Just something you may want to look into (ie move 3d surfaces so that they're not at the exact same z)
reply
samokhvalov 18 hours ago
Correct -- z-fighting on coplanar ground surfaces. Fixing with explicit offsets.

thanks

reply
antonyragleap 17 hours ago
Visualizing MVCC and transaction visibility would make this even more valuable as a learning tool.
reply
BowBun 20 hours ago
Amazing, great work. Keep polishing this up!
reply
bazzingadev 19 hours ago
Wow, cool projects are so back again
reply
kandros 14 hours ago
The logo shape of the platform is a very niche touch, kudos
reply
LowLevelKernel 18 hours ago
Wow. Can’t wait to explore the architecture
reply
terra_nera 15 hours ago
Anyone else getting Reboot vibes?
reply
deadbabe 20 hours ago
Someone should make a movie called “Postgres” which is about people living within a Postgres city, in the style of Se7en.

“Every city has secrets. Ours have indexes.”

reply
svog23 16 hours ago
So much stuff to see but looks very cool!
reply
Jonathanfishner 20 hours ago
thats cool. n1. spent 15min looking on it rn
reply
someothherguyy 17 hours ago
I like the education tools being developed using coding agents, but there should be some review in the process.

Good luck continuing it, hope you generated something that can be iterated on.

reply
npl 21 hours ago
Love this
reply
abstrct 20 hours ago
This is amazing!
reply
bibimsz 20 hours ago
i understood all that.
reply
soulcache 15 hours ago
maybe try adding tts to the tour? Lol
reply
paper_andbeyond 7 hours ago
[flagged]
reply
khanhnguyen8386 12 hours ago
[flagged]
reply
swaminarayan 8 hours ago
[dead]
reply
sqemo 17 hours ago
[flagged]
reply
runtime_lens 16 hours ago
[dead]
reply
codedump 19 hours ago
[dead]
reply
extra-AI 14 hours ago
[dead]
reply
Izmaki 10 hours ago
[flagged]
reply
luciana1u 19 hours ago
3.86B tokens to build a visual simulator of a database that runs on a fraction of that compute. we're using the expensive brain to draw pictures of the cheap brain.
reply
samokhvalov 18 hours ago
[dead]
reply