safeslice

Getting started

What Safeslice does, when to reach for it, and the shortest path from install to a working development database.

Safeslice copies a subset of a PostgreSQL database into another one, replacing personal data on the way out. The result is small enough for a laptop, realistic enough to find real bugs, and carries no customer records.

The problem it solves

Realistic data is what finds the bug: the null that only exists in row 4,000,000, the customer with 900 orders who breaks the query, the encoding no seed script invents. But a pg_dump of production does not know which columns hold people — it copies all of them, onto unmanaged laptops, into CI logs, into local backups. And 480 GB does not fit on a laptop anyway.

What it does instead

  1. Reads your schema from pg_catalog — no data.
  2. Walks the foreign-key graph from a root table, pulling every row’s parents with it.
  3. Replaces personal data in transit, deterministically, before it touches disk.
  4. Loads the result into a target database in dependency order.
  5. Scans the loaded database for values that still look like real personal data.

When not to use it

  • You need every row. Safeslice takes a slice. For a full copy, use pg_dump.
  • You need a byte-identical replica. Masked values are not the originals; that is the point.
  • Your data is not in PostgreSQL. Only PostgreSQL 13–17 is supported, and nothing else is planned.

Next

Install it, then run safeslice with no arguments — it asks for what it needs.