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:
- Runtime performance statistics (e.g. instruction count) on a per-
(benchmark, target, metric)basis —runtime_pstat*. - Artifacts under test —
artifact(keyed byname + tag + repo). - The distributed job queue —
benchmark_request,job_queue,collector_config. - Errors and runs —
error,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 like1.80.0. - tag (
text, defaultdefault): the collector tag the artifact was benchmarked under. The same commit on two machines is two rows. - repo (
text, defaultrust): the[repos.<key>]key identifying the repository. - date (
timestamptz): the artifact commit's date. - type (
text):master,try, orrelease. - 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 ismodule_path!()::fn_name). - target (
text, defaultx86_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): referencesruntime_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-recordentries). Partial indexidx_runtime_pstat_jsonon(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): referencesartifact.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): thejob_queuerow 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 usetry-<pr>). Unique. - parent_sha (
text, nullable): parent commit SHA — the comparison baseline. - repo (
text, nullable): the[repos.<key>]key for the request. - commit_type (
textNOT NULL):master,try, orrelease. - commit_date (
timestamptz, nullable): when the artifact commit was created. - pr (
integer, nullable): PR/MR number for master/try. - created_at (
timestamptzNOT NULL): when the request was created. - completed_at (
timestamptz, nullable): when the request completed. - duration_ms (
integer, nullable): request duration in ms. - status (
textNOT NULL):waiting_for_artifacts,artifacts_ready,in_progress, orcompleted(withcompleted_at/duration_ms). - benchmark_groups (
textNOT NULL, default''): comma-separated group names to benchmark; empty = repo defaults. - Unique index
benchmark_request_pr_commit_type_repo_idxon(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 (
timestamptzNOT NULL, defaultNOW()). - last_heartbeat_at (
timestamptz, nullable): updated by the collector; too-old →Offline. - is_active (
booleanNOT NULL, defaultfalse): 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): referencesbenchmark_request.tag;ON DELETE CASCADE. - benchmark_group (
textNOT NULL, default''): the benchmark group for this job. - collector_name (
text, nullable): referencescollector_config.name;ON DELETE CASCADE. - created_at (
timestamptzNOT NULL, defaultNOW()). - started_at (
timestamptz, nullable): when the collector claimed the job. - completed_at (
timestamptz, nullable): when the collector finished. - status (
textNOT NULL):queued,in_progress,success, orfailure. - retry (
integer, default 0): dequeue counter (incremented on each dequeue). - is_optional (
booleanNOT NULL, defaultfalse): if true, the request does not wait for this job. - tag (
textNOT NULL, defaultdefault): the collector tag used when storing results. - runtime_config (
textNOT NULL, default'{}'): serializedQueueRuntimeConfigJSON (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_idxon(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.