Halloween DealsAmazon USHalloween week deals: useful picks before month-endAmazon US: current deals, useful picks and tech finds.Check DealsClean PCRecommendedOne scan can reveal what keeps slowing WindowsLook for cleanup and repair opportunities.Run ScanHalloween DealsAmazon USOctober picks are moving - compare before checkoutAmazon US: current deals, useful picks and tech finds.See Picks×
FREEDOM251

Freedom251 › Blog › data quality

How to Validate Referential Integrity in Synthetic Data Before Production

By Freedom251 Team · · 10 min read

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Do not release synthetic relational data after a single foreign-key query. Validate it in layers: freeze the schema and relationship contract, verify keys and constraints, test every parent-child relationship, enforce business rules, compare fidelity and utility, assess privacy, and gate publication on a versioned report. Any unexplained referential-integrity violation is a release defect.

Synthetic data is useful for testing and research, but it can omit, distort, or introduce properties that do not exist in the source. The Office for National Statistics says its production method and appropriate uses must be documented, while UK Government Digital Service guidance updated 3 August 2026 warns that synthetic data is vulnerable to weakness, bias, and omission just as real-world data is. Apply the same seriousness of evaluation you would apply to production-like data.

As an Amazon Associate I earn from qualifying purchases.

What referential integrity means in synthetic data

Referential integrity means that every foreign-key value in a child table identifies the intended row in its parent table, subject to the relationship’s nullability and business rules. In generated data, this is more than checking whether two columns happen to contain matching strings. The parent population must be the correct one, composite keys must match as a set, cardinalities must be plausible, and rows must obey the same edit rules used to validate the source data.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

A generator can produce a database that loads successfully while still being unsafe for tests. It may create duplicate primary keys, orphaned child rows, impossible status transitions, a customer with too many orders, or a foreign key that matches an identifier in the wrong tenant. A database constraint catches only the violations it is configured to enforce; query-based audits are needed for cross-table and business-level rules.

#1 Best Overall
Sale
TOZO A1 Wireless Earbuds Bluetooth 5.3 Light Weight in Ear Headphones | IPX5 Waterproof,2 Mics for AI Calls,Immersive Premium Sound Bass Headset with Charging Case,32 EQ via App Black
  • [Ultra-Lightweight Ear Buds Designed for Small Ears] Each earbud weighs only 3.7g and features a compact, ergonomic in-ear design made especially for small ears. Secure, low-profile, and comfortable for workouts, all-day wear or overnight sleeping.The ultra-slim profile sits flush in your ear with no hard edges poking or rubbing, so you can even sleep on your side without discomfort.
  • [Immersive Stereo Sound with TOZO OrigX Technology] TOZO OrigX tuning delivers clear vocals, balanced mids, and natural stereo sound for music, podcasts, and videos.
  • [Long Battery Life for Daily Use] Get up to 7 hours of playtime on a single charge, with up to 32 hours total using the charging case—ideal for workdays, commuting, and extended listening sessions.
  • [Bluetooth 5.3 & Stable Connection] Bluetooth 5.3 provides fast pairing, stable wireless performance, and reduced dropouts as you move around home or office.
  • [Deep Bass with Clear Vocals] High-performance drivers produce punchy bass while keeping vocals clean and detailed for everyday listening.

Freeze the validation contract before generating data

Validation is reproducible only when the expected state is versioned before the release candidate is created. Store these artifacts together:

  • The source schema version, including table and column names, data types, lengths, precision, primary keys, unique constraints, nullability, and foreign-key actions.
  • A data dictionary defining allowed domains, units, formats, and semantic meaning.
  • A relationship map listing every parent and child table, the columns that form each key, optionality, and intended one-to-one or one-to-many cardinality.
  • The generator version, configuration, random seed or other reproducibility settings, and any transformation rules.
  • Acceptance thresholds for structural checks, relationship counts, fidelity metrics, utility tests, and privacy review.

Give the contract its own version identifier and record it in every validation report. A schema change, generator change, constraint change, or threshold change should create a new validation run rather than silently overwriting the old one.

Define the population boundary

Write down which parent population a foreign key is allowed to reference. This matters in multi-tenant, regional, or time-partitioned data: an identifier can exist in the database and still be invalid for a particular child row. Validation must test membership in the intended parent population, not merely a coincidental value match.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Validate structure before loading rows

Compare the generated structure with the frozen contract before inserting data. Reject a release candidate when it has missing columns, incompatible types, unexpected nullable changes, or extra required columns without defaults. Also verify precision and scale for numeric fields, maximum lengths for strings, and the exact columns participating in primary, unique, and foreign-key constraints.

Structural check What to compare Failure to reject
Tables and columns Names, presence, and order-independent identity Missing or unexpected objects
Data types Type, length, precision, and scale Values that truncate, coerce, or compare differently
Nullability and defaults Required versus optional columns and default expressions Nulls in required fields or required columns with no load value
Keys and constraints Primary keys, unique constraints, foreign-key columns, and actions on delete/update Duplicate identifiers or relationships enforced differently from the contract

Run these checks against the destination definition, not only against a generator configuration file. Deployment tooling can alter a column or omit a constraint even when the generator settings are correct.

Load tables in dependency order

Insert parent tables before children so that foreign-key checks operate on the complete intended population. Build a dependency graph from the relationship map and use a topological order where possible. Record the order in the job log so a failed load can be reproduced.

Rank #2
Sale
Smart Watch for Men Women Compatible with iPhone Samsung Android Phone 1.69 inch Full Touch Screen IP68 Waterproof Bluetooh Fitness Tracker Heart Rate/Sleep Monitor (Black)
  • 【IP68 Waterproof Multifunctinal Smart Watch】Torjalph fitness activity tracker smart watch is IP68 waterproof technology ,you can wear it when swimming,handwashing,it's rain-proof which means that you perform multiple exercise modes outside without worrying about sweat or rain corroding your fitness smart watch,and this watch equipped with a 230 mAh large capacity battery magnetic charging ,and this sports activity tracker watch can be used 5-7 days If fully charged.
  • 【Larger 1.83'' Full Screen Watch & Multi-dial Selection】1.83 inch full HD color touch screen smart watch for men / women provides excellent 240*284 resolution image quality ,This Bluetooth smart watch offers a better touch experience and remarkable immersion and ,more than 200 watch faces for you to choose from App"Da Fit ", you can change the dial style according to your mood to wear keeping the world on your wrist
  • 【Accurate Activity Tracker Smart Watch 】sports watch activity tracker uses sweat and dust resistant breathable silicone strap, our Fitness Tracker Smart Watch for Android iOS Phones supports 12 sports modes,walking,running,bicycle,swimming,badminton,basketball,football,rope skipping. This bluetooth calls smart watch for men women is lightweight and stylish, bringing more convenient and relaxing sports experience while also providing more protection.
  • 【Your 24 Hour Personal Daily Health Monitor】Fitness watch for women men full touch screen IP67 waterproof bluetooth smartwatch for Android iOS Phones with heart rate blood pressure monitor multifunction Andriod smart watch with steps counter sleep monitor sports fitness watch, monitoring blood oxygen saturation allows you to understand your physical condition in real time to track fitness progress ,to know your health status in time.
  • 【More Functions Bluetooth Call Smart Watch】This fitness activity smart watch full screen for iPhone and Android phones includes a bunch of new features including:The bluetooth smart watch can hang up the phone, receive and display WhatsAPP /Text /Facebook /Twitter /Messenger reminder.Support sedentary reminder, alarm clock, stopwatch, timer,weather information,music control, remote camera control compatible with Android 5.0 and above or iOS 9.0 and above smartphones.

Handling circular references

Circular references cannot be resolved by a simple parent-first order. Use a documented two-phase load: insert rows with a permitted temporary null or placeholder, then update the deferred foreign key after both sides exist. If the database supports deferrable constraints, defer them only inside the controlled test transaction. Temporarily disabling constraints can be appropriate for a test-only load when it is explicitly documented and followed by the complete audit suite; never publish an artifact produced with checks silently disabled.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Check primary keys, unique constraints, and required key columns

Run key checks before relationship checks. An orphan query can miss the root cause when a parent key is duplicated or a composite key is incomplete.

  • Assert that every primary-key value is present when the contract requires it.
  • Assert that no primary key occurs more than once.
  • Assert that every declared unique constraint is unique, including combinations of columns.
  • For composite keys, reject rows with only part of the key populated.
  • Reject nulls in non-nullable foreign-key columns; permit null only when the relationship is explicitly optional.
SELECT parent_id, COUNT(*) AS n
FROM parent
GROUP BY parent_id
HAVING COUNT(*) > 1;

Any returned row indicates a duplicate parent key. Add equivalent queries for each unique constraint and for composite keys using all key columns in the GROUP BY.

Run an orphan check for every foreign key

For each child foreign key, left join the child to the parent on the complete key and fail when a non-null child key has no matching parent. Treat returned rows as release defects unless a documented, risk-approved exception explains them.

Single-column relationship

SELECT c.child_id, c.parent_id
FROM child c
LEFT JOIN parent p ON p.parent_id = c.parent_id
WHERE c.parent_id IS NOT NULL
  AND p.parent_id IS NULL;

This query identifies child rows whose non-null parent_id has no parent match. Capture the count and a sample of offending values in the report, but do not replace the full check with sampling.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Composite relationship

SELECT c.*
FROM child c
LEFT JOIN parent p
  ON p.account_id = c.account_id
 AND p.region_code = c.region_code
WHERE p.account_id IS NULL;

Joining on only one component can produce false matches. The parent row must match every component of the declared key. Add explicit handling for nullable composite keys according to the contract: either all components are required, or the relationship is considered absent when the optional key is null.

Rank #3
New Bee Guitar Cable 10ft Electric Instrument Bass AMP Cord | 6.35mm Jack, Durable Design, Stage and Home Studio Use, Low Noise Shielded Electric Cord for Bass, Keyboard, Amp, Mixer
  • [Low Noise High Fidelity] New bee guitar cord with 22AWG oxygen-free-copper center conductors provides enhanced signal transfer, the PVC insulation material and the high-density stranded copper double shield provide noise rejection for quiet operation
  • [Ideal for Choice] New bee 1/4 straight and right angle metal connectors, ensures a secure connection in any instrument, pedal, or amp jack. L shape great fro on stage guitar stands
  • [Wide Compatible] Suitable for mixer, power amplifier, microphone, effector, decoder, equalizer, electoronic organ, electric guitar, electric bass and other electronic equipments. Widely used in the installation of smart home, karaoke speaker, professional stage audio, etc
  • [Easy Disassemble] Making incidental repairs quick and easy! Very nice, flexible cable
  • [Dont Hesite to Order] 24 hours customer services and professional technology team are standing by

Validate intended parent membership

After confirming that a key exists, check scope. For example, join a child account to the parent account and also assert the tenant, region, effective date, or partition condition required by the relationship. This catches a foreign key that points to a valid identifier belonging to another population.

Check cardinality and cross-table business rules

Foreign-key existence is necessary but not sufficient. Validate the relationship’s expected shape:

  • One-to-one relationships have at most one child for each parent and do not leave required counterparts missing.
  • One-to-many relationships respect documented minimum and maximum child counts.
  • Optional relationships allow zero children where specified, while mandatory relationships do not.
  • High-fan-out parents and empty parents are deliberately represented when the use case requires them.

Then run edit rules that involve several columns or tables. Examples include status transitions that follow an allowed sequence, an end date that is not earlier than a start date, invoice totals that equal the sum of detail rows, and child dates that fall within the parent’s active period. The Office for National Statistics describes this class of sanity and edit check as necessary because a valid-looking synthetic row can still violate the rules applied to real data.

What’s actually slowing this PC down?

Pick the symptom - the matching free tool is one click away.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Exercise both valid and invalid cases

Include fixtures that should pass and fixtures that should fail: a parent with zero children, a parent at the maximum child count, a boundary date, a null optional key, a rare category, and an intentionally orphaned child. A test suite that never demonstrates a failure can be wired incorrectly. Keep the invalid fixtures outside the release dataset and assert that each relevant check catches them.

Assess fidelity and utility after integrity passes

Once structure and relationships pass, compare the generated data with the source or an approved reference range. Select metrics for the intended use case rather than applying one universal threshold; the cited guidance does not provide a single numeric cutoff.

  • Compare row counts by table and by important time, tenant, or geographic slice.
  • Compare marginal distributions such as null rates, numeric summaries, and category frequencies.
  • Compare correlations and other dependencies that downstream analyses rely on.
  • Compare relationship distributions, including child counts per parent and the frequency of optional relationships.
  • Run the actual analytical, application, or test workload for which the dataset is being released and record whether it produces the expected outputs.

Keep the reference data used for these comparisons independent from the synthetic test fixtures where possible. UK Government Digital Service guidance notes that synthetic-only test configurations can pass while failing on real-world production data; independent validation data and distribution comparisons reduce that false confidence.

Rank #4
BSIMB 15.6" Digital Family Calendar & Chore Chart, No Subscription Fees
  • Digital Family Calendar: BSIMB digital calendar wall touch screen puts an end to your chaotic life. Designed for busy families, the digital calendar keeps you organised and in step with your family. Assign different colours and tasks to each family member to make family scheduling easier and more intuitive.
  • Easy Setup and Auto-Sync: Plug in, connect to WLAN and auto-syn your electric calendar in minutes. Digital wall calendar compatible with Google calendar, iCloud calendar, Outlook calendar, Cozi calendar and Yahoo calendar. Add events directly on the device or through the ecalendar app. Electronic calendar stays current whether you're at work or traveling—no manual updates needed.
  • All-In-One Home Assistant: Smart calendar builds habits and encourage independence with personalised chores. Display daily meal plan to reduce the daily ‘What's for dinner?’ stress. To-do lists keep track of everything you want. Turning chores into valuable achievements with stars and rewards, making life easier and more enjoyable.
  • Manage Anytime Anywhere: BSIMB electronic calendar for family stay connected with the powerful ecalendar app. Access and manage your digital wall calendar anytime, anywhere with free features like stars & rewards, photo screensaver, chore charts, meals plans, to-do lists etc. Electronic planner paid features like Magic Import tailor advanced tools for users with special needs.
  • Stay in Touch with Loved Ones: Share photos or videos from your phone to electronic wall calendar with app, instantly update your life moment, and keep in touch with your family, especially those who are far away; you can also surprise your smart calendar digital wall by sending him a wish card; it's also great for keeping tech-illiterate elders in touch with the youngsters.
Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

Test realism at boundaries and rare cases

Average rows can look correct while edge cases are absent. Deliberately inspect nulls, rare categories, maximum field lengths, boundary dates, empty parent populations, high-fan-out parents, and records near numeric limits. Verify that these cases retain valid keys and relationships, not just plausible individual values.

Free tools Windows power users keep installed

One-click scans. No signup required.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

For systems that enforce formats or edit rules, apply the same sanity checks used for the real dataset. Australian guidance specifically calls out type, format, range, outlier, completeness, and diversity validation, and recommends keeping a live test dataset for ongoing monitoring. Use that labelled set to detect drift when a generator or schema changes.

Assess privacy and preserve provenance

Referential integrity does not make synthetic data safe by itself. Singapore’s Personal Data Protection Commission recommends validating format and structure against the documented data dictionary, selecting fidelity and utility metrics, and assessing re-identification risk. Perform the organisation’s disclosure or re-identification assessment before release, including checks for unusual combinations that could identify a person or household.

Retain the generator and schema versions, configuration, reproducibility settings, source-data version, validation thresholds, complete results, exceptions, and approvals. Provenance lets an investigator explain how a value was produced and reproduce a failed run without retaining more source data than necessary.

Automate the release gate

Put structural checks, key checks, orphan queries, cardinality rules, business rules, fidelity comparisons, and privacy review status into the data-generation job or CI pipeline. Every check should emit a machine-readable result containing:

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
  • Contract, schema, and generator version identifiers.
  • Pass or fail status and execution timestamp.
  • Total rows examined and violation count.
  • A bounded sample of offending keys for diagnosis.
  • Thresholds used and links or identifiers for the supporting evidence stored in your controlled repository.
  • Exception ID, approver, expiry, and risk rationale when a release is allowed to proceed with a known issue.

Fail publication when any referential-integrity check has an unexplained violation. Do not convert an error into a warning merely because the synthetic database is for testing; a test that depends on valid relationships can hide defects when its fixtures are invalid.

Monitor after release

Keep a small labelled test set and rerun the suite after every schema, generator, constraint, or relationship-map change. Separate synthetic data from live data and production credentials. NHS England recommends purpose-built test environments where possible, auditing synthetic-data use, clear environment separation, and removal of synthetic records after testing. Apply those controls to prevent test records from being mistaken for real activity.

Troubleshoot common failures

Orphans appear after a successful load

First check whether the parent load was filtered by tenant, region, or date while the child load was not. Then verify that key values were not truncated, coerced in type, normalized differently, or generated before the final parent population was known. For composite keys, inspect every component. Re-run the duplicate-parent check before changing the generator.

Only some composite relationships fail

Look for null or blank components, inconsistent casing or padding, and a generator that samples each component independently. Generate the composite key as an atomic value or derive the child key from an existing parent row, then rerun the full relationship query.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Constraints block a circular load

Do not remove the relationship from the release schema. Use the documented two-phase or deferrable-constraint procedure, run all audits after the second phase, and preserve evidence that the final state satisfies the constraint.

Fidelity is acceptable but application tests fail

Check relationship distributions and business rules rather than only table-level counts. A dataset can match marginal category frequencies while missing rare combinations, valid status transitions, or the expected number of children per parent. Add the failed production-like scenario to the independent labelled test set.

Production checklist

  1. Version the schema, data dictionary, relationship map, generator configuration, and acceptance thresholds.
  2. Compare destination structure and constraints with that contract.
  3. Load parents before children, using a documented two-phase process for cycles.
  4. Check primary keys, unique constraints, composite-key completeness, and required-key nulls.
  5. Run a complete orphan query for every single-column and composite foreign key.
  6. Verify intended parent scope, cardinality, optionality, and cross-table edit rules.
  7. Exercise boundary, rare, empty-parent, high-fan-out, and intentionally invalid cases.
  8. Compare counts, distributions, dependencies, and relationship shapes for the intended use case.
  9. Complete privacy, provenance, and environment-separation controls.
  10. Publish only when all violations are resolved or covered by an explicit, approved exception, then retain the report and monitor after changes.

Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.

data qualityData Validationdatabase testingforeign keysreferential integritysynthetic data

Leave a Reply

Your email address will not be published. Required fields are marked *

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Recommended PC Tool
Recommended PC Tool
Windows Errors? Fix Them Before They SpreadFree repair scan
Crashes, No Sound, or Screen Glitches?Free driver scan

Two free Windows tools

One Free Minute Could Fix That PC

Before you go - each of these free tools takes about a minute and tackles what quietly slows a Windows PC down.

Special offer. View Outbyte info, uninstall instructions, EULA, and Privacy Policy.