RubyFlow The Ruby and Rails community linklog

×

The Ruby and Rails community linklog

Made a library? Written a blog post? Found a useful tutorial? Share it with the Ruby community here or just enjoy what everyone else has found!

Shrinking a 130 GB Postgres to a Local Copy with Greenmask: What Worked and What Brok

Staging had grown past 130 GB, a full pg_dump was out of the question, seeds never reproduced real bugs, and the data was full of PII. This post walks through building a small, FK-consistent, masked subset of a Rails app’s Postgres with Greenmask. It covers virtual references for Rails associations that never got a database FK, and masking every user to user<ID>@example.test with a known dev password. It also goes through the six things that broke and how each was fixed: NULL-owner rows slipping through, a self-referencing FK that panics the planner, invalid SQL from polymorphic references, orphan rows, the source running out of temp space on a 70 GB table, and a PostGIS NOTICE that aborts the restore. The result is a repeatable pipeline: restore by section, run a repair pass before the FKs are created, then verify.

Post a comment

You can use basic HTML markup (e.g. <a>) or Markdown.

As you are not logged in, you will be
directed via GitHub to signup or sign in