# benchmark_score

> Results of running Benchmark scenarios on Servers or managed Databases.

Primary key: `vendor_id`, `benchmark_id`, `resource_type`, `resource_id`, `config`. See the [version history of this table on dbdocs.io](https://dbdocs.io/spare-cores/sc-crawler?table=benchmark_score&schema=public&view=table_structure).

## Columns

| Column | Type | Constraints | References | Description |
| --- | --- | --- | --- | --- |
| `vendor_id` | `VARCHAR(255)` | PK | [`vendor.vendor_id`](https://docs.sparecores.com/schemas/tables/vendor.md) | Reference to the Vendor. |
| `benchmark_id` | `VARCHAR(255)` | PK | [`benchmark.benchmark_id`](https://docs.sparecores.com/schemas/tables/benchmark.md) | Reference to the Benchmark. |
| `resource_type` | `ENUM` | PK |  | Kind of resource the score refers to. See [ResourceType](#resourcetype) for the possible values. |
| `resource_id` | `VARCHAR(255)` | PK |  | Reference to the resource (see resource_type). |
| `config` | `JSON` | PK |  | Dictionary of config parameters of the specific benchmark, e.g. {"bandwidth": 4096} |
| `framework_version` | `VARCHAR(255)` |  |  | The version of the benchmark tool used. |
| `environment` | `JSON` |  |  | Extensible environment details (e.g. kernel_version, database_engine_version). |
| `score` | `FLOAT` | NOT NULL |  | The resulting score of the benchmark. |
| `score_breakdown` | `JSON` |  |  | Structured derivation of composite scores (e.g. workload profiles): per-component raw values, references, normalized values, weights, and coverage. Null for simple benchmark scores. |
| `note` | `VARCHAR(255)` |  |  | Optional note, comment or context on the benchmark score. |
| `status` | `ENUM` | NOT NULL |  | Status of the resource (active or inactive). See [Status](#status) for the possible values. |
| `observed_at` | `DATETIME` | NOT NULL |  | Timestamp of the last observation. |

## Foreign keys

- `vendor_id` → [`vendor`](https://docs.sparecores.com/schemas/tables/vendor.md) (`vendor_id`)
- `benchmark_id` → [`benchmark`](https://docs.sparecores.com/schemas/tables/benchmark.md) (`benchmark_id`)

## Enums

### ResourceType

Kind of resource a benchmark score refers to.

| Value | Description |
| --- | --- |
| `SERVER` | Compute server instance. |
| `DATABASE` | Managed database instance. |

### Status

Last known status of a record.

The docstrings of the values are shown to end-users (e.g. in the API and
on the website), so keep those to what a status means, and document here
how the statuses are set:

- `ACTIVE` and `INACTIVE` are valid for all tables. Records returned by
  the vendor or defined in code are `ACTIVE`. Records no longer returned
  or defined are set to `INACTIVE` by `pull`, as well as records missing
  from the source by `sync`.
- `PLANNED_FOR_RETIREMENT` and `RETIRED` are only valid for Server and
  Database, and are set only from explicit vendor signals. These are kept
  by `pull` when the record is no longer returned by the vendor.
- `ARCHIVED` is valid for all tables. It is set only from the
  [archive rules][sc_crawler.archive_rules] by `pull` and `sync`, also for
  child records (e.g. prices of a region), and archived records are not
  updated afterwards. It is our decision on the identity of a record,
  never a vendor signal: end of sale is `RETIRED`, and records no longer
  returned by a vendor are `INACTIVE`.

| Value | Description |
| --- | --- |
| `ACTIVE` | Currently available. |
| `INACTIVE` | Currently not available, without a known retirement. May become available again. |
| `PLANNED_FOR_RETIREMENT` | Retirement was announced by the vendor, but can still be ordered. Only used for servers and databases. |
| `RETIRED` | Retired by the vendor and cannot be ordered anymore, but prices may still exist (e.g. for active multi-year contracts). Only used for servers and databases. |
| `ARCHIVED` | Kept only for historical reference: replaced by another record (e.g. renamed, merged or split) or dropped from the dataset. |
