
SQL Benchmarks Lab
io.github.rctrutaPublished by GitHub account rctrutav0.1.2Updated Oct 24, 2026
Query pre-computed SQL engine benchmarks. Runs standalone, no server setup required.
Overview
Lets an assistant query pre-computed SQL engine benchmark results and run benchmark experiments locally through a packaged CLI harness.
- What you can do
- Exposes read tools over a catalog of SQL benchmark experiment capsules, including a tool to list results, and a submit_experiment tool for launching new runs. It can mount the benchmark REST API in-process, so no separate server is needed, or point at an API running elsewhere. The underlying harness runs deterministic, hash-addressed experiments across engines such as DuckDB and Postgres.
- When to use it
- Useful when comparing SQL engine or query performance, reproducing published benchmark capsules, or having an assistant look up existing benchmark numbers instead of guessing. Best for users already working with this benchmarking lab or its published results.
- Requirements
- Runs locally as a Python package (sqlbenchdag) via uvx, needing Python 3.11+ and uv. Docker is required for containerized engines such as Postgres and TypeDB, but not for the DuckDB-only quickstart. Optional environment variables: SB_API_BASE for a remote API base URL, and SB_RESULTS_DIR for the directory of experiment result capsules. No authentication is declared.
Installation
In SourceWeft
- Open SQL Benchmarks Lab in the dashboard and add it to a workspace.
- Enable the server for the chats that should use its tools.
Desktop only via STDIO. STDIO servers start a local process, so they need the SourceWeft desktop host.
Other MCP clients
Follow the launch instructions in the repository.
README
SQL Benchmarking Laboratory
A deterministic, orchestrated harness for verifying database performance at scale. Developed by Ramona C. Truta
[SQL Benchmarks Lab MCP server]
The Mission: "Ground Truth" as Code
This platform is a specialized laboratory for testing SQL performance hypotheses. It transforms query tuning from intuition into a reproducible science.
The core of the system is a Deterministic Orchestration Harness that guarantees that if the logic or the environment changes, the benchmark result changes. If they do not, the result is addressable and cached.
Scope: the focus to date is synthetic and canonical (TPC-H) data, which is the right instrument for mechanism experiments — where controlled, reproducible data isolates the variable under test. Real-data support exists but is experimental; see the FAQ for the synthetic-vs-real rationale, the container model, and the roadmap (AI-security testbed, real-data trust chain).
Key Features & Innovations
1. Context-Aware Semantic Hashing (The Experiment ID)
The Heart of the system is the Experiment ID, an 8-character hash that governs the entire lifecycle. This hash is a SHA-256 fingerprint generated from:
- The Config: Every dimension in your YAML (rows, skew, parameters).
- The SQL Logic: The actual content of the benchmarked scripts.
- The Code: All measurement-relevant Python — orchestration (
assets/), engine clients (resources/), and data generators (plugins/).
Semantic Normalization: The hashing engine distinguishes between a logic change and a formatting change.
- SQL: Comments, whitespace, and case are normalized before hashing.
- Python: Orchestration scripts are parsed into an Abstract Syntax Tree (AST) to strip docstrings and formatting variations, ensuring the Experiment ID only changes when execution logic changes.
2. Multi-Layer Cold-Cache Isolation
To ensure IO-bound performance is not masked by memory buffers, engine-level buffers are cleared before every query:
- Postgres: Mandatory Docker Container Restarts clear shared buffers.
- Versioned DuckDB (
duckdb_1_5,duckdb_2_0): every query runs in a fresh worker process, so DuckDB's buffer pool starts empty.
OS page cache: not evicted. Engines call thrash_os_cache, which dirties an anonymous memory region (half of available RAM, capped at 4 GB). On macOS this was measured to leave a cached 1 GB file fully resident, so measurements should be read as warm at the OS level. DuckDB clients take a required cold argument, and cold=True raises until a verified eviction step exists.
3. Agentic AI Integration
The platform is built for the future of Autonomous Engineering. The Experiment ID allows AI agents to treat the laboratory as a Deterministic Performance API.
- See AGENTS.md for the full Agentic Benchmarking Protocol.
4. Declarative Matrix Orchestration
Benchmarks are defined as N-dimensional matrices in YAML. The platform expands these into a Cartesian product of Independent Dagster Partitions. This allows for parallel dispatch and granular retries.
Usage & Technical Setup
Prerequisites
- uv: the project's Python environment & dependency manager (fast, modern).
setup.shuses it, and it can install Python 3.11 for you. - Python 3.11+: core runtime (uv provisions it if missing).
- Docker: for the containerized engines (Postgres, TypeDB), which the harness manages itself — not required for the DuckDB-only quickstart.
Installation & Setup
From PyPI — the lab is installable, which gives you the tooling and the sqlbench CLI:
From source — clone the repo to also get the published capsules (sql_benchmarks/experiments/results/) and the full harness. The laboratory includes a comprehensive setup script that manages virtual environments, dependencies, and directory initialization.
The Execution Workflow (CLI)
While the system is powered by Dagster, the primary interface is the CLI for automated workflows.
To write your own experiment, start from the annotated template and see the catalog of published runs in docs/experiments.md.
Project Structure
Managed with a strict separation between Harness and Scenario:
Published Experiments — the Quack investigation
The first published study with this lab: an independent measurement of DuckDB's Quack client-server protocol (beta, v1.5.3). Each row links the runnable config to its committed, verifiable capsule. Full numbers, scaling exponents, and verification steps in docs/published_capsules.md.
Act 0 (b82b4eae) is the exploratory scout that started it — see docs/published_capsules.md.
The lab also ships scenario suites for other studies — selectivity/,
null_logic/, null_sentinel/, recursion/, sort_spill/, tpch/, and more
under sql_benchmarks/scripts/sql/ — each runnable across the engine matrix.
Naming & Provenance
The lab works at two layers, named two different ways. Keeping them distinct is the difference between a number you can trace and a number you have to trust.
A release contains capsules; a capsule is one experiment. The machine names
capsules (hashes you can't forge); the author names releases (words that mean
something). sqlbenchdag is the lab's maker's mark — sql + bench +
dag (Dagster, the orchestration that distinguishes this lab from a bare query
timer). It is carried on every release this lab produces.
Two hashes, two jobs (a capsule contains both — they are not the same thing):
- the Experiment ID (8 chars) is an address — it names the capsule, and the same question always produces the same address;
- the integrity seal (64 chars, in
integrity.seal) is a checksum — it verifies the capsule's contents are untouched. You file by the address; the seal is the tamper-evident lid.
Reproducibility is pinned to the release. Because the Experiment ID hashes the measurement code, it is stable only at a fixed code revision — which is exactly what the signed release tag freezes. To reproduce a published capsule, check out its release tag and re-run its config; the same question yields the same ID, or the comparison is refused by construction.
Provenance roadmap: a per-capsule
generatorstamp (sqlbenchdag@<commit>) will record the exact build that produced each capsule. It writes through the finalization code, which lives inside the Experiment-ID hash, so it ships with a future release rather than re-numbering capsules already published.
See docs/published_capsules.md for the full trust chain (reproducibility, integrity, timestamp, authorship) and how to verify each. Reproducibility and integrity are automatic on every run; timestamp and signature are optional steps you add only when publishing — the producer workflow is docs/PUBLISHING.md.
License
Copyright 2025-2026 Ramona C. Truta. Licensed under the Apache License 2.0.
Built with Dagster, Polars, Docker, DuckDB, and Postgres.
Source: README.md at commit fb2ac80
Tools
0Version history
1- v0.1.2LatestSep 16, 2026
Score
50% of the applicable checks met
How complete this listing is, computed from the registry entry, the endpoint and public sources. Not a rating of the server and not a statement that it is safe or working today: reachability is a dated check, and no installs or reviews go into the score.
- Reached in the last 30 days25 pts
Keep the endpoint answering the MCP handshake; SourceWeft probes it every 30 days.
- Auth declared10 pts
Declare the credential headers in the registry entry, or keep the endpoint answering the probe so its auth can be classified.
- Tools listed15 pts
Answer tools/list without a credential, or ship a package that starts in a sandbox without one.
- DescriptionRequired15 pts
- Logo10 pts
- Documentation15 pts
- License10 pts