CLI Reference#
Commands#
| Command | Description |
|---|---|
up | Create schema (tables, indexes) |
seed | Populate tables with initial data |
run | Execute the benchmark workload |
deseed | Delete seeded data (truncate tables) |
down | Tear down schema (drop tables) |
all | Run up, seed, run, and down in sequence |
capturePRO | Generate a workload config from real query statistics |
cluster coordinatorPRO | Start the cluster coordinator server |
cluster agentPRO | Start a cluster agent |
cluster submitPRO | Submit a workload to the cluster |
cluster status [id]PRO | Show status of one or all cluster jobs |
cluster stream <id>PRO | Stream live progress from a running cluster job |
cluster cancel <id>PRO | Cancel a running cluster job |
cluster agentsPRO | List active cluster agents |
cluster resetPRO | Reset coordination database tables |
compare allPRO | Run up, seed, run, deseed, and down on both databases |
compare upPRO | Create schema on both databases |
compare seedPRO | Populate tables on both databases |
compare runPRO | Run workload on both databases simultaneously |
compare deseedPRO | Delete seeded data on both databases (truncate tables) |
compare downPRO | Tear down schema on both databases |
convertPRO | Convert between .yaml and .edg config formats |
edg <expression> | Evaluate a single expression and print the result |
fmt | Format .edg config files |
functions [search] | List available expression functions, optionally filtered by name |
fuzz <expression> | Evaluate an expression many times and report output statistics |
initPRO | Generate a starter config from an existing database schema |
jobs servePRO | Start an HTTP server that accepts workload configs via API |
jobs stream <id>PRO | Stream live progress from a running job |
jobs submitPRO | Submit a workload config to the job server |
perf breakpointPRO | Ramp workers until performance degrades |
repl | Interactive expression evaluator with tab completion |
scaffoldPRO | Interactive config generator wizard |
stage | Generate data to files instead of a database |
sync downPRO | Tear down schema on both databases |
sync runPRO | Write identical data to multiple databases |
sync verifyPRO | Verify data consistency between two databases |
template | Print a template workload config to stdout |
validate config | Validate a config file without connecting to a database |
validate license | Validate a license key and print its details |
version | Print the version |
workload <name> <command> | Run a built-in workload without a config file |
Running edg with an expression (no subcommand) evaluates it and prints the result. Bare words are treated as gofakeit patterns, so edg email is equivalent to edg "gen('email')". For expressions with parentheses or special characters, quote the argument.
A typical workflow runs the commands in order: up -> seed -> run -> down. The all command runs this entire sequence in a single invocation.
Flags#
| Flag / Env Var | Short | Default | Description |
|---|---|---|---|
--urlEDG_URL | Database connection URL. For Cassandra, comma-separated hosts are supported in the host portion (e.g. cassandra://user:pass@host1,host2,host3:9042/keyspace). Port, auth, and keyspace are parsed from the URL; the port applies to all hosts. | ||
--configEDG_CONFIG | Path or URL to the workload YAML config file (required for database commands, optional for repl) | ||
--driverEDG_DRIVER | pgx | Database driver name (pgx, mysql, mongodb, cassandra, mssql, oracle, dsql, or spanner) | |
--rng-seedEDG_RNG_SEED | PRNG seed for deterministic output (useful for regression testing) | ||
--duration | -d | 1m | Benchmark duration (run and all commands) |
--workers | -w | 1 | Number of concurrent workers. For run and all: number of worker goroutines. For seed: number of concurrent insert workers per exec_batch query. Values greater than 1 require a pro license.PRO |
--licenseEDG_LICENSE | License key for pro drivers (see Licensing) | ||
--retriesEDG_RETRIES | 0 | Number of transaction retry attempts on error (run and all commands). Uses exponential backoff (1ms, 2ms, 4ms, …). Only applies to transactions, not standalone queries. See Retries for details. | |
--errorsEDG_ERRORS | false | Print worker errors to stderr (run and all commands). See Error Output for details. | |
--print-interval | 1s | Progress reporting interval (run and all commands) | |
--metrics-addrEDG_METRICS_ADDR | Address for Prometheus metrics endpoint (e.g. :9090). Requires a pro license.PRO See Observability for details. | ||
--metrics-samplesEDG_METRICS_SAMPLES | 10000 | Maximum latency samples kept in memory for percentile calculation. Uses a sliding window (ring buffer) so memory stays bounded during long runs. Only affects p50/p95/p99; count, avg, and QPS are always exact. | |
--pool-sizeEDG_POOL_SIZE | 0 | Maximum number of open database connections. 0 uses the driver default (typically unlimited). | |
--no-waitEDG_NO_WAIT | false | Ignore wait durations configured in workload queries (run and all commands) | |
--embed-api-keyEDG_EMBED_API_KEY | API key for the embedding provider. Required for embed() expressions. | ||
--embed-urlEDG_EMBED_URL | Embedding API URL. Any OpenAI-compatible endpoint works (Ollama, vLLM, Azure OpenAI, etc.). | ||
--embed-modelEDG_EMBED_MODEL | Embedding model name sent in the API request. | ||
--embed-dimensionsEDG_EMBED_DIMENSIONS | 1536 | Number of dimensions requested from the embedding model. Must match the VECTOR(n) column type. | |
--embed-max-batchEDG_EMBED_MAX_BATCH | 0 | Max texts per embedding API call in batch queries. 0 means unlimited (all texts in one call). E.g. 30 on a 100-row batch produces 4 API calls (30, 30, 30, 10). | |
--warmup-duration | 0 | Warmup period before collecting metrics (e.g. 10s). Workers run during warmup but results are discarded. See Warmup for details. | |
--no-colorEDG_NO_COLOR | false | Disable colored log output. The standard NO_COLOR=1 environment variable is also respected per the no-color convention. | |
--no-atomic-txEDG_NO_ATOMIC_TX | false | Skip BEGIN/COMMIT for transaction blocks. Queries still run sequentially with shared locals and ref_same, but each statement commits independently. rollback_if conditions are skipped. | |
--overwriteEDG_OVERWRITE_STATS | false | Overwrite printed stats in-place instead of appending new blocks. Each progress tick clears the previous output and reprints, keeping the terminal clean during long runs. | |
--cassandra-default-consistencyEDG_CASSANDRA_DEFAULT_CONSISTENCY | Default consistency level for Cassandra queries. Accepts: any, one, two, three, quorum, all, local_quorum, each_quorum, local_one. When unset, the driver default (quorum) is used. | ||
--cassandra-idempotentEDG_CASSANDRA_IDEMPOTENT | false | Mark all Cassandra queries as idempotent. Enables speculative execution and retry on other nodes when a query fails mid-flight. Safe for read-heavy or repeatable-write workloads. | |
--cassandra-no-discoveryEDG_CASSANDRA_NO_DISCOVERY | false | Skip initial host discovery for Cassandra. Prevents the driver from querying system.peers to find other nodes, connecting only to the seed host in --url. Speeds up connection startup. | |
--cassandra-serial-consistencyEDG_CASSANDRA_SERIAL_CONSISTENCY | Serial consistency level for Cassandra lightweight transactions (LWT). Accepts: serial (global Paxos across all DCs) or local_serial (Paxos within local DC only). When unset, the driver default (local_serial) is used. Use serial for multi-DC consistency testing. | ||
--csv-file | CSV file to load as a reference table. The filename (minus extension) becomes the dataset name. Repeatable. See Configuration > Reference for details. | ||
--csv-directory | Directory of CSV files to load as reference tables. Each .csv file becomes a dataset. Non-recursive. Repeatable. | ||
--drain-timeoutEDG_DRAIN_TIMEOUT | 5s | Max time for in-flight operations to complete at shutdown. When the run timer fires, workers finish their current iteration using a separate context with this deadline instead of being cancelled immediately. Prevents silent result drops that cause expectation mismatches. | |
--request-timeoutEDG_REQUEST_TIMEOUT | 0 | Default timeout per query execution. 0 means no timeout. Overridden by per-query request_timeout when set. See Request Timeout for details. |
Cassandra LWT / CAS workloads require
--no-atomic-tx. Cassandra does not support lightweight transactions (IFconditions) inside batches, so transaction blocks must run each statement independently. For multi-DC consistency testing, set--cassandra-serial-consistency serialto use global Paxos consensus. A typical LWT consistency test invocation looks like:edg run \ --driver cassandra \ --url "cassandra://user:pass@host1,host2,host3:9042/keyspace" \ --cassandra-default-consistency local_quorum \ --cassandra-serial-consistency serial \ --no-atomic-tx \ -w 10 -d 5m
MongoDB tuning is done via URI parameters in
--urlrather than dedicated flags. The MongoDB driver parses all options from the connection string, so append query parameters to control consistency, read routing, and connection behaviour. Common parameters:
Parameter Values Effect w0,1,2, …,majority, or a custom tag set nameWrite concern. See write concern values below. readConcernLevellocal,available,majority,linearizable,snapshotRead isolation level. See read concern values below. readPreferenceprimary,primaryPreferred,secondary,secondaryPreferred,nearestWhich replica serves reads. nearestgives lowest latency;secondaryoffloads the primary.retryWritestrue,falseRetry failed writes once (default: true).directConnectiontrue,falseConnect to a single node without topology discovery. loadBalancedtrue,falseRequired when connecting through an L4 load balancer (e.g. Atlas Serverless). connectTimeoutMSmilliseconds Connection timeout (edg default: 10000).serverSelectionTimeoutMSmilliseconds How long the driver waits for a suitable server (edg default: 10000).Example with majority write concern and linearizable reads:
edg run \ --driver mongodb \ --url "mongodb://localhost:27017/mydb?w=majority&readConcernLevel=linearizable" \ --config workload.edg \ -w 10 -d 5m
MongoDB write concern values#
wvalueMeaning 0Fire-and-forget. No acknowledgement from the server. 1Acknowledged by primary only (default). 2,3, …Acknowledged by that many replica set members. majorityAcknowledged by a majority of replica set members. Won’t be rolled back. custom tag Acknowledged by members matching a custom getLastErrorModestag set.MongoDB read concern values#
readConcernLevelvalueMeaning localMost recent data from the node (default for primary reads). May be rolled back. availableLike localbut for sharded clusters. It doesn’t wait for orphaned docs to be cleaned. Lowest latency.majorityOnly data acknowledged by a majority. Won’t be rolled back. linearizableReflects all successful majority writes before the read. Single-document only, primary only. Highest consistency. snapshotPoint-in-time snapshot across a transaction. Requires w=majority. Transactions only.For consistency testing,
w=majority+readConcernLevel=majorityis the common combination.snapshotis stronger but only works inside transactions. Use--retries 3to handle transientWriteConflicterrors under contention.
Every flag with an env var listed above can be set via the environment instead of the command line. Flags take precedence over environment variables, which take precedence over defaults.
export EDG_URL="postgres://root@localhost:26257?sslmode=disable"
export EDG_DRIVER="pgx"
export EDG_CONFIG="workload.edg"
# No need to pass --url, --driver, or --config:
edg run -w 10 -d 5m
# Flags override env vars when both are set:
edg run -w 10 -d 5m --driver mysql --url "user:pass@tcp(localhost:3306)/db"Remote Config#
The --config flag accepts HTTP and HTTPS URLs. edg fetches the YAML and runs it the same as a local file.
# Serve a config directory
python3 -m http.server 8000 -d examples/tpcc
# Run edg against it
edg all \
--driver pgx \
--config "http://localhost:8000/workload.edg" \
--url "postgres://root@localhost:26257?sslmode=disable" \
-w 1 \
-d 10s
!includedirectives are not resolved for remote configs, since there is no local filesystem to resolve relative paths against.
Example#
Database#
Run each lifecycle command individually against a database, or use all to run the entire sequence in one invocation.
edg up \
--driver pgx \
--config examples/tpcc/crdb.edg \
--url "postgres://root@localhost:26257?sslmode=disable"
edg seed \
--driver pgx \
--config examples/tpcc/crdb.edg \
--url "postgres://root@localhost:26257?sslmode=disable"
edg run \
--driver pgx \
--config examples/tpcc/crdb.edg \
--url "postgres://root@localhost:26257?sslmode=disable" \
-w 100 \
-d 1m
edg deseed \
--driver pgx \
--config examples/tpcc/crdb.edg \
--url "postgres://root@localhost:26257?sslmode=disable"
edg down \
--driver pgx \
--config examples/tpcc/crdb.edg \
--url "postgres://root@localhost:26257?sslmode=disable"Or use all to run the entire workflow in one command:
edg all \
--driver pgx \
--config examples/tpcc/crdb.edg \
--url "postgres://root@localhost:26257?sslmode=disable" \
-w 100 \
-d 5mAurora DSQL#
The dsql driver uses AWS IAM authentication instead of a username and password. Pass the cluster endpoint as the --url value:
edg all \
--driver dsql \
--config workload.edg \
--url "clusterid.dsql.us-east-1.on.aws" \
-w 10 \
-d 5mAWS credentials are resolved from the standard chain (environment variables, ~/.aws/credentials, IAM role, etc.). The region is parsed from the cluster endpoint automatically. Auth tokens are refreshed on every new connection, so long-running workloads work without interruption.
DSQL uses PostgreSQL-compatible SQL, so use $1, $2 placeholders in your queries.
Licensing#
The pgx, mysql, mongodb, and cassandra drivers are free to use. Pro drivers (oracle, mssql, dsql, spanner) require a license key passed via --license or EDG_LICENSE. The license is validated before connecting to the database. See the Licensing page for full details.
Validating Config#
The validate config command parses a config file and checks it for errors without connecting to a database. It catches YAML syntax errors, invalid expressions, unknown function calls, duplicate query names, shadowed built-ins, and invalid query types. Errors include YAML line numbers when available.
edg validate config --config examples/tpcc/workload.edgconfig is validAdd --explain for enhanced error messages with explanations and correct syntax examples:
edg validate config --config workload.edg --explainline 42: duplicate query name "seed_users"
Query names must be unique across all sections. They serve as dataset keys
for ref_* functions and as metric labels. Rename one of the duplicates.This is useful for catching mistakes before deploying a workload or as a CI check.
Validating a License#
The validate license command checks whether a license key is valid for a given driver and prints the license details.
edg validate license --driver oracle --license "your-license-key"License info:
ID: acme-corp
Email: admin@acme.com
Drivers: [oracle mssql]
Issued at: 2025-01-15
Expires at: 2026-01-15
License is valid for driver "oracle".If the driver doesn’t require a license, the output tells you:
edg validate license --driver pgx --license "your-license-key"License info:
ID: acme-corp
Email: admin@acme.com
Drivers: [oracle mssql]
Issued at: 2025-01-15
Expires at: 2026-01-15
Driver "pgx" does not require a license.If the license is expired or doesn’t cover the requested driver, you’ll see an error:
edg validate license --driver dsql --license "your-license-key"License info:
ID: acme-corp
Email: admin@acme.com
Drivers: [oracle mssql]
Issued at: 2025-01-15
Expires at: 2026-01-15
Error: license does not include driver "dsql" (licensed: [oracle mssql])The EDG_LICENSE environment variable is also accepted:
export EDG_LICENSE="your-license-key"
edg validate license --driver oracleRetries#
The --retries flag controls how many times a failed transaction is retried before the error is recorded. The default is 0 (no retries). Retries only apply to transactions (queries wrapped in a transaction: block), not standalone queries.
When a transaction fails, edg waits with exponential backoff before retrying:
| Attempt | Backoff |
|---|---|
| 1st retry | 2ms |
| 2nd retry | 4ms |
| 3rd retry | 8ms |
| 4th retry | 16ms |
| nth retry | 2^n ms |
If all retry attempts fail, the last error is recorded in the stats and the worker continues to the next iteration. Context cancellation (e.g. Ctrl+C or duration expiry) stops retries immediately.
edg run \
--driver pgx \
--config workload.edg \
--url ${DATABASE_URL} \
--retries 3 \
-w 10 \
-d 5mError Output#
By default, individual query errors during the run phase are counted but not printed. The --errors flag prints each error to stderr as it occurs, which is useful for debugging:
edg run \
--driver pgx \
--config workload.edg \
--url ${DATABASE_URL} \
--errors \
-w 10 \
-d 5m2025/04/23 14:32:07 ERROR run error worker=3 error="running run query debit_source: pq: insufficient funds"
2025/04/23 14:32:07 ERROR run error worker=7 error="running run query debit_source: pq: insufficient funds"Without --errors, the same failures still appear in the summary table’s ERRORS column and count toward error_rate in expectations.
Connection Pool#
The --pool-size flag sets the maximum number of open database connections (SetMaxOpenConns and SetMaxIdleConns). The default 0 uses the driver’s default, which is typically unlimited.
Setting pool size is useful for:
- Simulating constrained environments where the application has a fixed connection budget.
- Preventing connection exhaustion when running with many workers against a database with connection limits.
- Isolating connection overhead from query performance in benchmarks.
edg run \
--driver pgx \
--config workload.edg \
--url ${DATABASE_URL} \
--pool-size 20 \
-w 50 \
-d 5mIn this example, 50 workers share 20 connections. Workers that can’t acquire a connection will block until one becomes available.
Warmup#
The --warmup-duration flag runs workers for a specified period before collecting metrics. During warmup, query results are discarded. They don’t appear in progress output, the summary, Prometheus metrics, or expectations.
This produces cleaner benchmark results by allowing the database to warm its caches, JIT-compile query plans, and reach a steady state before measurement begins.
edg run \
--driver pgx \
--config workload.edg \
--url ${DATABASE_URL} \
--warmup-duration 30s \
-w 10 \
-d 5mIn this example, workers run for 30 seconds of warmup (discarded), then 5 minutes of measured execution. The total wall-clock time is 5m30s.
When using stages, warmup applies before the first stage begins collecting metrics.
Request Timeout#
The --request-timeout flag sets a default timeout for each individual query execution. When set, every query gets a context deadline of the specified duration. A query that exceeds the timeout is cancelled and counted as an error.
Per-query timeouts can be set with request_timeout in the config, which takes precedence over the global flag:
run {
fast_lookup(request_timeout: 500ms) `SELECT * FROM users WHERE id = $1` (ref_rand('fetch_users').id)
slow_report(request_timeout: 30s) `SELECT count(*) FROM orders GROUP BY region`
}run:
- name: fast_lookup
request_timeout: 500ms
args: [ref_rand('fetch_users').id]
query: SELECT * FROM users WHERE id = $1
- name: slow_report
request_timeout: 30s
query: SELECT count(*) FROM orders GROUP BY regionWhen neither a per-query request_timeout nor the global --request-timeout flag is set, queries run without a timeout (bounded only by the worker’s context).
Run Behaviour#
Workers and Initialisation#
Each worker gets its own isolated environment. The init section runs once, and its results are cloned to each worker so that functions like ref_rand and ref_diff don’t interfere across workers. Per-worker state includes sequence counters (seq), permanent row picks (ref_perm), and NURand constants.
Stages#
When a config file includes a stages section, each stage defines its own worker count and duration, and stages run sequentially. Explicitly passing -w or -d overrides the stages section and falls back to single-stage mode. See Configuration > Stages for details.
edg run \
--driver pgx \
--config examples/stages/workload.edg \
--url "postgres://root@localhost:26257?sslmode=disable"Error Handling#
Query errors during run are non-fatal. The worker logs the error and increments an error counter but continues to the next iteration. This lets you observe error rates without aborting the benchmark. Errors in other sections (up, seed, deseed, down, init) are fatal and stop execution immediately.
Interrupting with Ctrl+C#
Pressing Ctrl+C during run or all cancels the workload gracefully. Workers finish their current iteration and stop. When using all, the cleanup phase (down) still runs after interruption, using a fresh context.
Output#
During the run, progress is printed at the --print-interval (default: every second):
59s / 1m0s
QUERY COUNT ERRORS AVG p50 p95 p99 QPS
check_balance 3674 0 2.631ms 2.367ms 4.154ms 6.252ms 62.3
credit_target 3769 0 1.68ms 1.495ms 2.624ms 3.911ms 63.9
debit_source 3769 0 2.376ms 2.13ms 3.722ms 5.288ms 63.9
read_source 3770 0 2.047ms 1.803ms 3.254ms 5.052ms 63.9
read_target 3769 0 2.839ms 2.579ms 4.486ms 6.446ms 63.9
TRANSACTION COMMITS ROLLBACKS ERRORS AVG p50 p95 p99 TPS
make_transfer 3769 0 0 13.053ms 12.424ms 18.498ms 26.074ms 63.9After all workers complete, a final summary is printed:
summary
Duration: 1m0.004s
Workers: 1
QUERY COUNT ERRORS AVG p50 p95 p99 QPS
check_balance 3749 0 2.628ms 2.362ms 4.14ms 6.249ms 62.5
credit_target 3828 0 1.681ms 1.497ms 2.624ms 3.911ms 63.8
debit_source 3828 1 2.381ms 2.13ms 3.724ms 5.338ms 63.8
read_source 3829 0 2.046ms 1.802ms 3.25ms 5.052ms 63.8
read_target 3829 0 2.843ms 2.583ms 4.485ms 6.446ms 63.8
TRANSACTION COMMITS ROLLBACKS ERRORS AVG p50 p95 p99 TPS
make_transfer 3828 0 1 13.063ms 12.438ms 18.498ms 26.652ms 63.8
Transactions: 19063
Errors: 1
tpm: 19061.6| Metric | Description |
|---|---|
| COUNT | Total successful query executions |
| ERRORS | Total failed query executions |
| AVG | Mean execution time per query |
| p50 | Median latency (50th percentile, sliding window) |
| p95 | 95th percentile latency (sliding window) |
| p99 | 99th percentile latency (sliding window) |
| QPS | Queries per second (count / elapsed seconds) |
| tpm | Transactions per minute across all queries |
Expectations#
When the config file includes an expectations section, results are printed after the summary and the exit code reflects whether all expectations passed:
expectations
PASS error_rate < 1
PASS check_balance.p99 < 100
FAIL tpm > 5000
1 expectation(s) failedIf any expectation fails, edg exits with status code 1. When using all, teardown (down) still runs before the non-zero exit.
See Configuration > Expectations for the full list of available metrics and expression syntax.
Formatting#
The fmt command applies canonical formatting to .edg config files. It preserves comments, normalizes indentation to 2 spaces, and leaves SQL inside backticks untouched.
# Print formatted output to stdout.
edg fmt workload.edg
# Format in-place.
edg fmt -w workload.edg
# Format multiple files.
edg fmt -w *.edgRunning fmt twice produces identical output (idempotent). The formatted file is semantically equivalent to the original, edg validate config will produce the same result before and after formatting.
Formatting rules#
| Rule | Detail |
|---|---|
| Indentation | 2 spaces per nesting level |
| Blank lines | Normalized to at most 1 between declarations |
| Comments | Preserved in place (# leading and trailing comments) |
| SQL | Content between backticks is never modified |
| Single argument | Kept inline: (expr) |
| Multiple arguments | One per line, indented, closing ) at the query’s indent level |
| Inline sections | Single-query sections that fit on one line are kept inline |
Performance Testing#
The perf command contains tools for finding the performance limits of a database.
Breakpoint PRO#
The perf breakpoint command finds the point where your database starts to degrade under load. It starts with 1 worker and adds another every --ramp-interval, monitoring latency, throughput, and errors and printing warnings whenever a percentage threshold is encountered (e.g. 50 meaning 50% more errors, 50% greater p99 latency or 50% fewer QPS). When an absolute --stop-p99, --stop-qps, or --stop-errors limit is hit, it stops and prints the summary.
edg perf breakpoint \
--driver pgx \
--config workload.edg \
--url ${DATABASE_URL} \
--ramp-interval 30s \
--threshold 50 \
--stop-p99 100msSee Breakpoint Testing for flags, degradation warnings, stop conditions, and examples.