Large-scale Generation
Generate millions of synthetic rows with sampling, streaming, and batch tuning.
Last updated October 20, 2018
Overview
When generating large datasets (millions of rows per table), three factors affect performance: distribution sampling, batch size, and memory management.
Sampling strategies
By default, Weavori automatically preserves realistic data distributions when generating synthetic data. For very large tables, you have four options:
Fast mode
Use --fast to prioritize speed over distribution accuracy. Best for large tables or quick test datasets.
Fixed sample
Use --sample-rows to draw a fixed-size sample of rows for distribution analysis when you want explicit control over the sample size.
No sampling
Use --no-sampling to skip distribution sampling entirely. Fastest possible generation, but output values will be purely random.
Schema caching
Schema introspection results are cached per source database. On repeat runs against the same database, Weavori skips the introspection phase and uses the cached schema.
- Default: Cache enabled. Schema is re-introspected automatically when it changes.
- Bypass: Use
--no-cacheonweavori generateto force fresh introspection. - Purge all: Run
weavori cache clearto delete all cached schemas.
For details on how the cache works, automatic invalidation, and environment-specific best practices, see Schema & Caching Management.
Streaming and batching
Weavori generates and exports data in a streaming fashion — rows are produced, batched, and written incrementally. Memory usage stays constant regardless of total row count.
The sync command batches rows with --batch (default 5,000 rows). Larger batches reduce round trips but increase memory per batch. Start with the default and adjust based on throughput:
Output modes for monitoring
During long runs, choose the output format that best suits your monitoring needs:
--output pretty— Human-readable with colors (default for terminals)--output plain— Timestamped log lines, ideal for CI/CD log capture--output json— Machine-readable JSONL for programmatic processing
Sync compatibility mode
If the target database requires compatibility mode, use --mode insert:
The --mode insert flag applies to weavori sync.
Best practices
- Start with
estimate— verify connectivity and schema before running a large generation - Use
--fastfor wide schemas — prioritizes speed over distribution accuracy - Use
--sample-rowsfor huge tables — draw a fixed sample when the source has over a billion rows - Use
--no-cachefor CI — ensure fresh introspection on each pipeline run - Monitor per-table timing — identify slow tables and adjust their sampling strategy
- No-sampling for speed — if distribution accuracy doesn't matter,
--no-samplingis fastest