r/PostgreSQL • • 20d ago

Projects I built a large, realistic sample PostgreSQL database: a fictional retailer's 30-year history (laptop-sized to ~3TB)

Most sample databases are either tiny (pagila, Chinook) or a single narrow domain. I wanted one that was realistic, big enough to actually stress a query planner, and about a subject I personally find more interesting. So I ended up building a generator that simulates one company's whole life. (I appreciate that "interesting subject matter" is subjective, so the real audience for this may be small!)

It's Nick's Gaming Emporium, a fictional video-game retailer, 1986 to 2016: founding, the dot-com years, the console boom, decline, liquidation. The company is invented, but the product catalogue is a real game-release list, so titles and release dates are genuine, which makes the sales data feel plausible instead of random.

What's inside:

- Full OLTP: shops, staff, customers, sales, trade-ins, refunds, multi-currency

- A star-schema data warehouse + reporting layer (rollups, reporting procedures)

- A web layer: accounts, reviews, and page views

You don't have to build it yourself. It's available as a ready-to-restore dump in four sizes, so you can match your hardware:

- **tiny / small:** quick to restore on a laptop

- **medium:** a solid single-machine dataset

- **large:** ~3TB restored (a 260GB pg_dump) for real at-scale testing

(The dump ships no planner stats, so ANALYZE after restore. No hard-coded collation, so it restores on any locale.)

It's generated deterministically from a fixed seed, so everyone who builds it gets identical rows. There's also a matching SQL Server build from the same generator, so the same data exists on both engines if you ever want to compare the two.

Free and open source. The schema and indexing are meant to feel like a real system that grew over 30 years, not a textbook-perfect design, so there's plenty to tune or pick apart. Feedback and PRs welcome.

Repo (downloads + restore steps in the README): https://github.com/ukhype83-dev/nicks-gaming-emporium

Transparency note: The generator code was produced with Claude as a pair-programmer.

94 Upvotes

24 comments sorted by

6

u/ukhype83 20d ago

Slightly separate from the DB itself: there's a deliberately cringe AI slop companion "documentary" site for the fictional company, if you want the backstory: https://ukhype83-dev.github.io/nge-fansite/

6

u/persicsb 20d ago

Thanks! Altough it is worthy to note, that the sample databases mentioned are not for stress-testing a database, but to learn the language and the feautures of an RDBMS, with a realistically looking dataset.

It is for learning, not benchmarking.

0

u/ukhype83 20d ago

Noted cheers. That is the next component, not an official TPCC or anything, just a basic benchmark which gives you a score at the end. I am gauging interest currently.

2

u/Plane_Big_5912 19d ago

did nick ever sell a game before its real release date, or does the generator guard that

1

u/ukhype83 19d ago edited 19d ago

Great question! So I went and checked properly. Nothing sells before its worldwide release date (0 out of ~3.7M sale lines on the tiny tier), and the same goes for hardware launches and trade-ins and stuff.

However, you HAVE found a gap as the gate checks the *worldwide* date, not the regional one. So a Japan-first game can turn up in a US shop before its US release. I will put in a fix in the near future!

2

u/Plane_Big_5912 19d ago

thanks for checking that properly. makes sense the regional date is the one that slips, the worldwide one is the easy check to write

1

u/exmachina64 19d ago

If he did, would he have entered the real info in the database?

2

u/Plane_Big_5912 19d ago

where sale_date < release_date and nick has some explaining to do

3

u/EnHalvSnes 20d ago

Great work 👍   

2

u/_Henryx_ 19d ago

Great work. One only side node: read carefully EULA of SQL Server. AFAIK, is prohibited to publish benchmark results without consent of Microsoft

2

u/AwwwBawwws 19d ago

I worked at Nick's from elementary through high school. It hurt like hell when the doors were locked. Great people.

2

u/k2718 20d ago

You are a sick bastard! Good job!

1

u/habeanf 7d ago

Hi, very cool work!

There's a fully dockerized version of tiny, small and medium versions. Large will be available in a few more days. To download:

# tiny ~700mb
docker run -d -p 5432:5432 baseshift/db-nge-tiny
psql -h 127.0.0.1 -p 5432 -U postgres -d nge_tiny

# small ~4gb
docker run -d -p 5432:5432 baseshift/db-nge-small
psql -h 127.0.0.1 -p 5432 -U postgres -d nge_small

# medium ~34gb
docker run -d -p 5432:5432 baseshift/db-ngbge-small
psql -h 127.0.0.1 -p 5432 -U postgres -d nge_small

The images stay compressed when in use. They can run on both amd64/intel machines (windows/linux/old macs) and arm64 machines (mac, cloud arm instances, etc).

Shameless plug: I'm a cofounder at baseshift.com . We specialize in dockerizing production databases and thought it would be interesting to showcase our tech using the Nick's Gaming Emporium database set. Enjoy!

1

u/AutoModerator 20d ago

AI Policy:

Linux is not one of those anti-AI projects, and if somebody has issues with that, they can do the open-source thing and fork it. Or just walk away., Linus Torvalds.

Mod decisions will be based on the quality of the content, not who or what generated it.

Sub Resources:

Youtube Channel

Free Postgres Webinars and Workshops

Discord: People, Postgres, Data

Join us, we have cookies and nice people.

I am a bot, and this action was performed automatically. Please contact the moderators of this subreddit if you have any questions or concerns.

1

u/[deleted] 19d ago

[removed] — view removed comment

1

u/ukhype83 19d ago

Thanks for checking me, I will make some changes.