# Synthetic Database Generation: What It Is, How It Works

> A synthetic database is test data that preserves schema and foreign keys without copying real rows. PostgreSQL, MySQL, SQL Server, and Oracle supported.

Canonical: https://subsetra.com/synthetic-database
Language: en

Synthetic database generation: test data that keeps schema and foreign keys

## What a synthetic database is

A synthetic database behaves like a real database but does not copy real rows. It has tables, rows, primary and foreign keys, and indexes. Queries, joins, and application code should work as in production — yet inspecting content should reveal no real customer, order, or patient record.

That is a different object from fake rows in a single CSV. A synthetic database is a schema: types, constraints, and relationships the engine accepts on load. How it is produced — seed script, random library, masking, or profile-based method — is the topic of [synthetic data generation](/synthetic-data-generation). The question here is whether what you get is truly a database or only filled columns.

## What a good synthetic database preserves

A good synthetic database preserves three things at once.

**Schema.** The source table layout, column types, primary keys, and indexes exist on the target engine. Otherwise the application does not recognize the schema.

**Relationships.** Every foreign key points at a real parent row. Composite keys and self-references (for example employee–manager) stay valid. Load must finish without errors with constraints enabled.

**Value shape.** Columns follow the source's statistical patterns: date ranges, category frequency, linked columns. Reference tables (country, currency, category) do not balloon when event tables grow. Cross-table ratios — orders per customer, for example — stay plausible.

If any of these is missing, the result may be “synthetic data” but not a database you can test against. Output with broken foreign keys breaks CI and integration tests even when individual rows look realistic.

## How it differs from a production copy

Teams often copy production and mask sensitive columns for production-like test data. That path keeps real rows in test. Storage, refresh time, and audit scope grow. Under KVKK and GDPR, the test environment may still be a system that holds personal data.

In a synthetic database, production rows are not copied. New rows are generated from a recipe learned from the source. That does not replace debugging scenarios where you must reproduce one specific real record; masked subset may fit there. For development, staging, and CI that need production-like behavior without customer records, a synthetic database can replace the copy and narrow audit scope.

We explain why we took this path in [realistic test databases without copying production](/blog/realistic-test-databases-without-copying-production).

## Which engines it runs on

A synthetic database must actually load on the target engine. Types, identity columns, bulk loaders, and constraint syntax differ by engine. Subsetra Lyrebird supports these four today:

- PostgreSQL
- MySQL
- SQL Server
- Oracle

## How to generate a synthetic database with Lyrebird

Lyrebird connects read-only once and writes schema, relationships, and value patterns into a `.lyre` profile. Then it disconnects. The synthetic database is generated offline on your machine from that profile: parents first, then children; every foreign key points at a valid parent.

Output may be SQL files with a manifest, native bulk-loader files for SQL Server and Oracle, or a database loaded straight into Docker. The same profile, settings, and seed give the same data. Community generates up to 5,000 rows per table, is free, and runs on Linux, macOS, and Windows. Larger volume and pipelines are Enterprise.

In November 2026, roughly 300 million rows were generated from profiles across five unnamed real-world databases; among roughly 1.6 million rows loaded at smaller size, none of roughly 300 checked foreign keys were broken. Measurement conditions and timings are on the [Lyrebird page](/lyrebird).

Compare the source and synthetic tables for [Pagila on PostgreSQL](/lyrebird/samples/pagila), [Chinook on MySQL](/lyrebird/samples/chinook), [AdventureWorksLT on SQL Server](/lyrebird/samples/adventureworks-lt), and [Human Resources on Oracle](/lyrebird/samples/human-resources). Each example includes the downloadable generation profile and measured foreign-key checks.

- [Generate with Lyrebird](https://subsetra.com/lyrebird)
- [Compare sample databases](https://subsetra.com/lyrebird/samples)
- [Request a demo](https://subsetra.com/request-demo)
- [Methods compared](https://subsetra.com/synthetic-data-generation)

## FAQ

### What is a synthetic database?

A complete test database that behaves like a real one without copying real rows: tables, rows, primary and foreign keys, indexes. Queries and application code should work as in production, with no real customer records inside.

### Which database engines can use a synthetic database?

Lyrebird generates synthetic databases for PostgreSQL, MySQL, SQL Server, and Oracle. A profile from one engine can be generated to the same or another engine. (Masking and subsetting are a separate Ark product and support PostgreSQL and MySQL.)

### Does a synthetic database contain real customer rows?

Lyrebird does not copy production rows; new rows are generated from the profile. That helps test environments avoid holding customer records and can narrow KVKK and GDPR audit scope. If you must reproduce one specific real record one-to-one, a synthetic database may not be the right tool.

### Do foreign keys break?

They should not in a good synthetic database. Lyrebird generates parent tables before children and binds every child to a valid parent key. In our measurements, among roughly 1.6 million rows loaded at smaller size, none of roughly 300 checked foreign keys were broken. Verify on your schema with constraints enabled on load.
