PGSimCity - How PostgreSQL Works

Posted by jonbaer 17 hours ago

Counter840Comment82OpenOriginal

Comments

Comment by layoric 16 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.

Comment by titzer 16 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.

Comment by npl 16 hours ago

Yea on mobile especially

Comment by samokhvalov 15 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)

Comment by nugator 7 hours ago

~3.86B * $5/M tokens ≈ $19.3k

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

Comment by hectormalot 4 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.

Comment by samokhvalov 2 hours ago

correct on both counts

Comment by saransh12345 10 hours ago

Share the prompt here please?

Comment by samokhvalov 2 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)

Comment by npl 1 hour 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.

Comment by yieldcrv 14 hours ago

single prompt Claude Design before putting it in Claude Code

Comment by derac 11 hours ago

maybe try adding tts to the tour?

Comment by andyfilms1 15 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.

Comment by appplication 14 hours ago

I think in this case a tour is fine and sort of the point. But I disagree with you generally.

Comment by vixen99 12 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.

Comment by narmiouh 16 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.

Comment by samokhvalov 13 hours ago

try pressing T

Comment by INTPenis 10 hours ago

How to rotate camera?

Comment by justinclift 7 hours ago

If you're using a keyboard and mouse, then SHIFT + left mouse button seems to work.

Comment by narmiouh 4 hours ago

That's fantastic, please tell me I was short sighted and missed this when I wrote my comment.

Comment by samokhvalov 2 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)

Comment by willquack 5 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

Comment by Curtis_Guan 16 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.

Comment by tptacek 15 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.

Comment by inigyou 6 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.

Comment by MitziMoto 15 hours ago

I heard you have some free time now, so let's see it!

Comment by robertlagrant 8 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.

Comment by notachatbot123 10 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?

Comment by parthdesai 1 hour ago

Not entirely sure, but the person vibe coding this does know Postgres really well tbf

Comment by itomato 6 hours ago

Glean anything or learn something in particular?

This is a brutalist gew-gah.

Comment by stronglikedan 49 minutes ago

Nit, but there's no dash in gewgah.

Comment by fragmede 9 hours ago

LLMs aren't that bad anymore.

Comment by INTPenis 6 hours ago

Like any tool they're as good as the wielder.

Comment by stronglikedan 44 minutes ago

Except most tools aren't constantly improving exponentially.

Comment by youre-wrong3 9 hours ago

[dead]

Comment by dbgrman 49 minutes 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.

Comment by arjie 15 hours ago

I can't believe "Rendering The First Frame..." is not "Reticulating Splines..." :)

Cool UI.

Comment by jedberg 13 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.

Comment by augunrik 13 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)

Comment by jedberg 13 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.

Comment by chrisweekly 2 hours ago

yeah, interactivity would be next-level (as several others in these threads have mentioned)

Comment by thelastgallon 2 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).

Comment by WiSaGaN 6 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.

Comment by loveparade 16 hours ago

I don't know what I am looking at but it is fabulous.

Comment by getfluxly 12 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.

Comment by citizenpaul 19 minutes ago

> I wish there's like a live query thing

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

Comment by samayashar 10 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!

Comment by npunt 16 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.

Comment by harvie 5 hours ago

We've got GPU accelerated PostgreSQL sooner than GTA VI...

Comment by dostick 15 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.

Comment by computomatic 15 hours ago

Try the tour. It’s exactly that.

Comment by samokhvalov 13 hours ago

yep (via pressing T)

but I agree, could be better – thinking

Comment by johnhamlin 3 hours ago

UI looks great on a 32" monitor, idk what everyone's complaining about ;)

Comment by skreem 16 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

Comment by smhaziq 15 hours ago

it is in the commit 'Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>'

Comment by robertlagrant 8 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.

Comment by antoinetouss 10 hours ago

I love this, let's do all of Data Intensive Application SimCity!

Comment by futurecat 10 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.

Comment by itomato 6 hours ago

Jira professional here, and OpenRCT2 has been my mental (and my agent’s) model for something similar.

Comment by num42 15 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.

Comment by gregsadetsky 15 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)

Comment by samokhvalov 13 hours ago

Correct -- z-fighting on coplanar ground surfaces. Fixing with explicit offsets.

thanks

Comment by manytimesaway 14 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.

Comment by DonHopkins 8 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...

Comment by laurentiurad 10 hours ago

how do you know it has been vibe-coded? And why does it matter?

Comment by j1436go 10 hours ago

Because it reduces my trust in the truthfulness of the represented information.

Comment by laurentiurad 9 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?

Comment by bspammer 9 hours ago

The AI generated text in the tour is a good clue. But I also don’t think the author is denying it.

Comment by antonyragleap 12 hours ago

Visualizing MVCC and transaction visibility would make this even more valuable as a learning tool.

Comment by kandros 9 hours ago

The logo shape of the platform is a very niche touch, kudos

Comment by BowBun 16 hours ago

Amazing, great work. Keep polishing this up!

Comment by bazzingadev 14 hours ago

Wow, cool projects are so back again

Comment by terra_nera 10 hours ago

Anyone else getting Reboot vibes?

Comment by LowLevelKernel 13 hours ago

Wow. Can’t wait to explore the architecture

Comment by deadbabe 15 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.”

Comment by svog23 11 hours ago

So much stuff to see but looks very cool!

Comment by Jonathanfishner 15 hours ago

thats cool. n1. spent 15min looking on it rn

Comment by someothherguyy 13 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.

Comment by npl 16 hours ago

Love this

Comment by abstrct 15 hours ago

This is amazing!

Comment by bibimsz 16 hours ago

i understood all that.

Comment by soulcache 11 hours ago

maybe try adding tts to the tour? Lol

Comment by paper_andbeyond 2 hours ago

[flagged]

Comment by swaminarayan 3 hours ago

[dead]

Comment by khanhnguyen8386 7 hours ago

[flagged]

Comment by sqemo 12 hours ago

[flagged]

Comment by runtime_lens 11 hours ago

[dead]

Comment by codedump 14 hours ago

[dead]

Comment by extra-AI 9 hours ago

[dead]

Comment by Izmaki 5 hours ago

[flagged]

Comment by luciana1u 14 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.

Comment by samokhvalov 13 hours ago

[dead]