This guide walks through a complete WorkloadLens run using the bundled example data.
Using the install script (creates a venv and runs smoke tests):
bash install.sh
source .venv/bin/activateOr manually:
python3 -m venv .venv && source .venv/bin/activate
pip install -e ".[test]"
workloadlens versioncd examples/quickstart
bash run.shThis runs the full pipeline on a small retail schema with 5 queries and sample data.
The run.sh script executes two commands:
-
workloadlens init— Creates aworkloadlens.jsonconfig pointing to the local schema, queries, and data files. -
workloadlens pipeline— Runs the three pipeline stages in sequence:- run — Parses each SQL file against the schema, extracting operator counts, join topology, function usage, expression depth, and other query-centric signals. Outputs
coverage/coverage.jsonl. - data — Scans the
.tbldata files, computing table-level metrics (row count, file size, bytes/row) and column-level statistics (NULL rates, MCV, string lengths, numeric outliers, histogram skew). Outputsdata/data_metrics.jsonl. - report — Aggregates the JSONL files into a PDF report with tables, histograms, and percentile plots. Outputs
reports/workloadlens_report.pdf.
- run — Parses each SQL file against the schema, extracting operator counts, join topology, function usage, expression depth, and other query-centric signals. Outputs
After the run, examples/quickstart/outputs/ contains:
outputs/
├── coverage/
│ └── coverage.jsonl # One JSON record per query
├── data/
│ └── data_metrics.jsonl # One JSON record per table + per column
├── reports/
│ └── workloadlens_report.pdf # Visual summary
└── report.json # Machine-readable aggregate
coverage.jsonl — Each line is a JSON object with fields like query_name, join_count, operator_counts, functions, predicates, expression_depth, and type distributions.
data_metrics.jsonl — Each line describes either a table (row count, file size) or a column (NULL rate, NDV, MCV top-K, string length stats, outlier rate, histogram Q-error).
PDF report — Contains summary tables, operator share charts, join-count histograms, null-rate percentile curves, and data distribution plots.
To compare two workloads, create configs for each and use workloadlens compare:
workloadlens compare \
-c quickstart=workloadlens_a.json \
-c other=workloadlens_b.json \
--out comparison.pdf \
--json-out comparison.json \
--no-openThis produces a side-by-side PDF highlighting differences in operator mix, join depth, data skew, and schema structure.
- Signal definitions — See signals.md for the full catalog of query-centric and data-centric metrics.
- Methodology — See methodology.md for sampling strategy, histogram construction, outlier detection, and verification workflow.
- CLI reference — Run
workloadlens --helpor any subcommand with--helpfor all available options.