How Do You Build Load Test Data? Production-Scale Data Without Personal Data
· DataMint · 7 min read
Three weeks before go-live, the performance test went well. Response time: 0.3 seconds. Then on the first day live, the same screen takes eight seconds. Looking for the cause, the transaction table in the test database had 500,000 rows and production had 400 million.
Load test data needs two things. As much volume as production, and the same distribution as production. The second is often missed. Data that matches only the row count takes a different execution plan from production, and so gives a different result. The surest way to get both is to bring the production data over and change only the personal data.
What happens when you inflate by copying rows
The most common approach is to copy existing data many times to reach the row count. Insert 10,000 rows 40,000 times and you have 400 million. The count is right. But a database does not look only at the count.
| Item | Production | Data inflated by copying | Result |
|---|---|---|---|
| Number of distinct values | 8 million customers | 10,000 customers repeated | Index selectivity differs, so a different execution plan |
| Skew | Top 1% of customers have 30% of transactions | Everyone has the same count | Slow queries for large customers do not show up |
| Date distribution | More in recent periods, clustered at month end | The same dates repeated | Range queries and partition behavior differ |
| Row length | Memos are sometimes empty, sometimes long | The same length | Rows per block and I/O differ |
| NULL ratio | Differs by column | Fixed at whatever the original sample had | Predicate estimates differ |
| Physical order | Scattered after ten years of accumulation | Neatly in insert order | Cost of reading through an index differs |
The first row is the biggest problem. The optimizer builds its plan from statistics. In a 400-million-row table with only 10,000 distinct customer numbers, the condition "customer number = ?" returns 40,000 rows, and the optimizer may choose a full scan over the index. In production, the same condition returns 50 rows. The same SQL takes a different path. That is why the test result does not predict production.
The second row also bites often in practice. Most customers have two or three accounts, but one corporate customer has three thousand. Data built from averages does not contain this customer. It first shows up after go-live, when that corporation's account manager opens the screen.
The regulation mentions load testing specifically
If you are in the financial sector in Korea, there is a provision worth knowing. Article 13(1)(8) of Korea's Electronic Financial Supervision Regulations (in Korean) says not to use user (customer) information in testing, and that in "cases where the use of user information is unavoidable, such as load testing," it must be converted before use and deleted as soon as the test ends. In effect, the regulation also recognizes that load testing is hard without production data. In return there are two conditions. Convert it, and delete it when you are done.
What to take care of when converting production data
Do not touch the values that make the distribution
What should change is the values that identify a person: name, resident registration number (RRN, Korea's national ID number), contact details, address, account number. Transaction timestamps, amounts, product codes, status codes and branch codes stay as they are. These values make the distribution, and performance follows the distribution.
Converted values need the same number of distinct values
If you change every name to the same name, the selectivity of the name index collapses. If you change the second half of every RRN to asterisks, the number of distinct values in that column drops from millions to tens of thousands. Different originals have to become different values, one to one, for indexes to behave as they do in production.
Keys and indexes the same as production
Performance measured on a test database that is missing one index means nothing. Primary keys, unique keys, foreign keys, indexes and partitioning have to match production. And statistics have to be gathered again after the load finishes. On a table without statistics, the optimizer plans by guesswork.
The time to move the data becomes a problem itself
Converting and moving hundreds of millions of rows is a big job in itself. Reading and inserting one row at a time takes days, which does not fit the test schedule, so you end up bringing only part of the data. You need to be able to split large tables into ranges and move them concurrently, and to use the bulk load feature of the receiving database.
Delete it when you are done
The load test database is the largest of the test environments. It holds about as much as all of production. Leaving it in place after the test round ends also carries the largest risk. How to set a deadline at creation time is covered in when should used test data be deleted.
Load test data checklist
| Item | What to check |
|---|---|
| Row counts | Are the row counts of the main tables the same order of magnitude as production? |
| Number of distinct values | Is the number of distinct values in columns used in predicates close to production? |
| Skew | Are the customers and accounts with the most rows as large as in production? |
| Keys and indexes | Are the same indexes and partitions as production in place? |
| Statistics | Were statistics gathered after the load? |
| Execution plans | Are the plans of a few key SQL statements the same as in production? |
| Personal data | Were the values that identify a person converted? What about memo columns? |
| Deadline | Has it been decided when to delete? |
We recommend the sixth row. Before starting the test, pick just the five most important SQL statements and put the execution plans from production and the test database side by side. If the plans differ, the test result says nothing about production.
Preparing it with DataMint Core
DataMint Core reads data from the production database, changes only the personal data, and loads it into the test database. Columns that are not converted go across as they are, so the distribution of dates, amounts and codes is the same as production. For converted values too, different originals become different values, so index selectivity is kept.
- It creates tables and primary keys, unique keys, foreign keys and indexes the same as production.
- Large tables are split into ranges and moved in parallel, and high-speed loading is used for Oracle.
- When a run ends, the rows read and rows loaded are recorded for each table, so you can check right away whether the counts match.
- Jobs that read production data go through approval, and test data is deleted automatically when the retention period passes.

You will want to know the speed. Numbers depend heavily on the environment, so take this for reference only. On our development PC, moving 100 million rows from PostgreSQL to PostgreSQL with four transformation rules took 4 minutes 47 seconds. In a real environment it varies with the network, disks and table structure, so the right thing is to measure with your own data before adopting.
Closing
A load test is an attempt to know in advance "how many seconds will this screen take in production." The answer is only as right as the data resembles production. Do not stop at filling the row count. Check that the number of distinct values and the skew match production too. And data like that is faster to get by bringing it from production and removing only the people than by making it up.
- #load test data
- #performance test data
- #large-volume test data
- #test data
- #data migration
- #production-like data