Schema

中文版:schema_CN.md

The current database schema, duplicated across the two supported backends (Postgres for distributed, SQLite for local). This document covers the runtime benchmark, job-queue, artifact, and error tables — the tables used by the runtime-benchmarking and distributed system documented here.

Legacy compile-time tables out of scope. The schema also carries tables inherited from upstream rustc-perf for compile-time benchmarks (pstat, pstat_series, benchmark, rustc_compilation, raw_self_profile, artifact_size). These are not documented here and are not part of the runtime-benchmark documentation set. They are left in place by the migrations; do not drop them.

Overview

The database tracks four groups of things:

  1. Runtime performance statistics (e.g. instruction count) on a per-(benchmark, target, metric) basis — runtime_pstat*.
  2. Artifacts under test — artifact (keyed by name + tag + repo).
  3. The distributed job queuebenchmark_request, job_queue, collector_config.
  4. Errors and runserror, collection.

Performance run statistics (runtime)

  ┌────────────┐  ┌───────────────┐  ┌────────────┐
  │ artifact   │  │ collection    │  │ error       │
  ├────────────┤  ├───────────────┤  ├────────────┤
┌►│ name       │  │ id *          │  │ id *        │
│ │ tag        │  │ perf_commit   │  │ aid         │
│ │ repo       │  └───────────────┘  │ message     │
│ │ date       │                      │ context     │
│ │ type       │                      │ job_id      │
│ └─────┬──────┘                      └────────────┘
│       │ aid
│ ┌─────────────────────┐  ┌──────────────────┐
│ │ runtime_pstat_series│  │ runtime_pstat     │
│ ├─────────────────────┤  ├──────────────────┤
└►│ id *                 │◄┐│ series           │
  │ benchmark            │ └┤ aid              │
  │ target               │  │ cid              │
  │ metric               │  │ value            │
  └─────────────────────┘  │ json_value        │
                            └──────────────────┘

Tables

artifact

A build of the software under test.

Columns:

  • name (text): identifier — a commit SHA or a tag like 1.80.0.
  • tag (text, default default): the collector tag the artifact was benchmarked under. The same commit on two machines is two rows.
  • repo (text, default rust): the [repos.<key>] key identifying the repository.
  • date (timestamptz): the artifact commit's date.
  • type (text): master, try, or release.
  • Unique constraint: (name, tag, repo).

collection

A "collection" of statistics tied together, differing only by the statistic collected. Corresponds to a single test result. Records the git SHA of the running collector binary.

Columns:

  • id (integer): unique id.
  • perf_commit (text): rust-bench commit/tag the collector was built from.

runtime_pstat_series

The parametrisation of a runtime benchmark: a unique (benchmark, target, metric) triple.

Columns:

  • id (integer): unique id.
  • benchmark (text): the benchmark name (for #[bench] this is module_path!()::fn_name).
  • target (text, default x86_64-unknown-linux-gnu): compilation target triple.
  • metric (text): the metric name (e.g. instructions:u, wall-time, max-rss).
  • Unique constraint: (benchmark, target, metric).

runtime_pstat

A measured runtime metric value, unique per (series, artifact, collection).

Columns:

  • series (integer): references runtime_pstat_series.id.
  • aid (integer): artifact id.
  • cid (integer): collection id.
  • value (double precision): the measured numeric value (e.g. nanoseconds, instruction count).
  • json_value (text, nullable): structured JSON report for the metric (e.g. perf-record entries). Partial index idx_runtime_pstat_json on (series, aid, cid DESC) WHERE json_value IS NOT NULL (postgres.rs:521).

error

Records an error contextual to a benchmark job: a compilation/runtime error or a job-level error.

Columns:

  • id (bigint/serial): auto-incrementing primary key.
  • aid (integer): references artifact.id.
  • message (text): the error message.
  • context (text): a short note about why/where the error occurred (e.g. the benchmark name).
  • job_id (integer, nullable): the job_queue row the error belongs to.

benchmark_request

A request to benchmark an artifact. See job-queue.md.

Columns:

  • id (serial): primary key.
  • tag (text, NOT NULL): artifact identifier (commit SHA or release tag; try requests without a SHA use try-<pr>). Unique.
  • parent_sha (text, nullable): parent commit SHA — the comparison baseline.
  • repo (text, nullable): the [repos.<key>] key for the request.
  • commit_type (text NOT NULL): master, try, or release.
  • commit_date (timestamptz, nullable): when the artifact commit was created.
  • pr (integer, nullable): PR/MR number for master/try.
  • created_at (timestamptz NOT NULL): when the request was created.
  • completed_at (timestamptz, nullable): when the request completed.
  • duration_ms (integer, nullable): request duration in ms.
  • status (text NOT NULL): waiting_for_artifacts, artifacts_ready, in_progress, or completed (with completed_at/duration_ms).
  • benchmark_groups (text NOT NULL, default ''): comma-separated group names to benchmark; empty = repo defaults.
  • Unique index benchmark_request_pr_commit_type_repo_idx on (pr, commit_type, repo) WHERE status != 'completed' (postgres.rs:594-595).

Removed columns (migrated away): backends, profiles, targets, branch, repo_url.

collector_config

Registered collectors.

Columns:

  • id (serial): primary key.
  • name (text, NOT NULL, UNIQUE): the collector tag — must match [collectors].tags.
  • date_added (timestamptz NOT NULL, default NOW()).
  • last_heartbeat_at (timestamptz, nullable): updated by the collector; too-old → Offline.
  • is_active (boolean NOT NULL, default false): only active collectors receive jobs.
  • commit_sha (text, nullable): the rust-bench commit the collector is running.

Removed columns (migrated away): target, benchmark_set.

job_queue

Benchmark jobs awaiting/being executed by collectors. See job-queue.md.

Columns:

  • id (serial): primary key.
  • request_tag (text): references benchmark_request.tag; ON DELETE CASCADE.
  • benchmark_group (text NOT NULL, default ''): the benchmark group for this job.
  • collector_name (text, nullable): references collector_config.name; ON DELETE CASCADE.
  • created_at (timestamptz NOT NULL, default NOW()).
  • started_at (timestamptz, nullable): when the collector claimed the job.
  • completed_at (timestamptz, nullable): when the collector finished.
  • status (text NOT NULL): queued, in_progress, success, or failure.
  • retry (integer, default 0): dequeue counter (incremented on each dequeue).
  • is_optional (boolean NOT NULL, default false): if true, the request does not wait for this job.
  • tag (text NOT NULL, default default): the collector tag used when storing results.
  • runtime_config (text NOT NULL, default '{}'): serialized QueueRuntimeConfig JSON (repo key, build cmd/dir, is_rust, post_build, per-collector overrides, extra_args).
  • Unique constraint: (request_tag, benchmark_group, tag).
  • Index job_queue_status_tag_idx on (status, tag).

Removed columns (migrated away): target, backend, profile, benchmark_set, kind.

Migrations

Postgres migrations are a linear Vec<&str> applied in order on first connection (database/src/pool/postgres.rs:307-603, tracked in a migrations table). Each migration is idempotent where possible (guarded by IF EXISTS/IF NOT EXISTS). The SQLite backend mirrors the same schema in database/src/pool/sqlite.rs.