Request demo
V Valk Get early access
← Back to home

Simulation Engine

Test database optimizations in a secure sandbox before touching production. Get before/after proof — not guesses.

How simulation works

When Valk detects an anomaly like a slow query, it doesn't just suggest a fix — it proves the fix works.

1
Package the scenario

Valk extracts your schema structure and builds a test scenario with the problematic query and proposed fix.

2
Spin up isolated database

A fresh PostgreSQL instance is created with your exact schema and synthetic test data. No network access. Completely isolated.

3
Run before & after

Execute the query multiple times to get baseline metrics. Apply the fix. Run again. Compare median execution times.

4
Destroy & report

The sandbox is destroyed. You get a detailed report with execution times, improvement percentage, and confidence level.

Before
245ms
Sequential scan
CREATE INDEX applied
After
12ms
Index scan
95%
faster

Secure by design

Simulations run in completely isolated environments. Your production data never leaves your infrastructure.

No network access

Sandbox instances cannot reach the internet or any internal services. Complete network isolation.

Ephemeral

Every sandbox is created fresh and destroyed after use. No persistent storage. Nothing lingers.

Synthetic data only

We generate realistic test data that matches your schema types. Your actual row data is never used.

Timeout enforced

Simulations have strict time limits. Runaway queries are terminated automatically.

Resource limited

Each sandbox has capped CPU and memory. No single simulation can consume excessive resources.

Validated scripts only

Only pre-validated SQL from Valk's analysis runs in the sandbox. No arbitrary code execution.

Configuration options

Tune simulations to match your production environment for more accurate results.

PostgreSQL version
PostgreSQL 14 PostgreSQL 15 PostgreSQL 16

Match your production version for accurate query planner behavior.

Resource allocation
Memory 512 MB - 4 GB
CPU 0.5 - 4 cores
Test data volume
10,000 rows (quick test)
50,000 rows (balanced)
100,000 rows (thorough)
Execution settings
Iterations per test 3 runs (median)
Timeout 180 seconds
Warm-up queries Enabled

What can be simulated

Simulation works best for query optimizations where we can measure before/after performance.

Can simulate
Slow Query
Test index additions to reduce execution time
Index Type Mismatch
Compare B-tree vs. partial index performance
Missing Index
Validate suggested index improves query
Cannot simulate (yet)
Vacuum Needed
Requires actual table bloat buildup over time
Table Growth
Trend-based anomaly, not query-fixable
Unused Index
Removal verification coming soon

Confidence levels

After simulation, Valk provides a recommendation based on the measured improvement.

>80%
Strongly recommended

High confidence this fix will significantly improve performance.

50-80%
Recommended

Good improvement expected. Worth applying.

20-50%
May help

Moderate improvement. Consider trade-offs.

<20%
Likely not helpful

Minimal improvement. May not be worth the overhead.

Try the Playground

Don't wait for anomalies. Paste any query, propose any fix, and see the before/after instantly.

Open Playground