# database

> Managed database SKUs.

Primary key: `vendor_id`, `database_id`. See the [version history of this table on dbdocs.io](https://dbdocs.io/spare-cores/sc-crawler?table=database&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. |
| `database_id` | `VARCHAR(255)` | PK |  | Unique identifier, as called at the Vendor. |
| `name` | `VARCHAR(255)` | NOT NULL |  | Human-friendly name. |
| `api_reference` | `VARCHAR(255)` | NOT NULL |  | How this resource is referenced in the vendor API calls. This is usually either the id or name of the resource, depending on the vendor and actual API endpoint. |
| `api_reference_object` | `JSON` |  |  | How this resource is referenced in the vendor API calls, including the parameter name(s). |
| `display_name` | `VARCHAR(255)` | NOT NULL |  | Human-friendly reference (usually the id or name) of the resource. |
| `description` | `VARCHAR(255)` |  |  | Short description. |
| `family` | `VARCHAR(255)` |  |  | Broad workload class of the database in the vendor''s own naming, e.g. General Purpose or Memory Optimized. |
| `series` | `VARCHAR(255)` |  |  | Hardware line and generation of the database, matching the series of the server it runs on, where known. |
| `server_id` | `VARCHAR(255)` |  |  | Reference to the underlying cloud server''s identifier. |
| `vcpus` | `INTEGER` |  |  | Number of virtual CPU cores allocated to the database server instance. |
| `memory_amount` | `INTEGER` |  |  | Amount of RAM (MiB) provisioned for the instance. |
| `engine` | `ENUM` |  |  | Managed database engine running on the instance. See [DatabaseEngine](#databaseengine) for the possible values. |
| `wire_protocol` | `ENUM` |  |  | Network protocol used for client connections. See [DatabaseWireProtocol](#databasewireprotocol) for the possible values. |
| `engine_versions` | `JSON` | NOT NULL |  | Major database engine versions supported. |
| `auto_upgrade_versions` | `BOOL` |  |  | Auto-upgrade between minor database engine versions. |
| `ha` | `JSON` | NOT NULL |  | Ordered HA levels supported, highest tier first. |
| `ha_strategy` | `JSON` | NOT NULL |  | Ordered HA strategies supported, highest tier first. |
| `max_read_replicas` | `INTEGER` |  |  | Maximum number of read-only replica nodes supported to scale read workloads. |
| `custom_config` | `BOOL` |  |  | Whether database engine parameters/flags can be customized. |
| `custom_extensions` | `BOOL` |  |  | Support for custom database engine extensions/plugins. |
| `storage_size` | `INTEGER` |  |  | Bundled storage capacity included in the database (GB). |
| `storage_extra_min` | `INTEGER` |  |  | Minimum custom storage size (in GB) that can be attached to the instance. |
| `storage_extra_max` | `INTEGER` |  |  | Maximum storage limit (in GB) supported by the instance or storage tier. |
| `storage_extra_autosize` | `BOOL` |  |  | Whether storage capacity can automatically expand as disk usage grows. |
| `compatible_storage_ids` | `JSON` |  |  | List of database_storage_ids that can be attached to the database as extra storage. |
| `disk_encryption` | `BOOL` |  |  | Indicates whether underlying storage drives are encrypted at rest. |
| `scheduled_backups` | `BOOL` |  |  | Support for automated snapshot schedules and backup retention management. |
| `continuous_backups` | `INTEGER` |  |  | Maximum point-in-time recovery (PITR) log retention window expressed in days (0 if unsupported). |
| `connection_pool` | `BOOL` |  |  | Managed connection proxy support. |
| `system_monitoring` | `BOOL` |  |  | Availability of host-level CPU, RAM, and disk metrics dashboards. |
| `database_monitoring` | `BOOL` |  |  | Database engine performance insights (slow queries, locks, execution plans). |
| `autotuning_advice` | `BOOL` |  |  | Analyzes workload and generates actionable performance tuning advice. |
| `autotuning_apply` | `BOOL` |  |  | System automatically executes performance fixes (e.g., index creation, parameter tuning) without operator intervention. |
| `sla` | `FLOAT` |  |  | Service level agreement as a percentage, e.g. 99.95. |
| `security_features` | `JSON` | NOT NULL |  | Security capabilities supported by DBaaS providers. |
| `retirement_date` | `DATE` |  |  | Retirement date announced by the vendor for PLANNED_FOR_RETIREMENT and RETIRED records: the end of support (shutdown) if published, otherwise the end of sale. Empty when not announced or not known. |
| `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`)

## Enums

### DatabaseEngine

Managed database engine.

| Value | Description |
| --- | --- |
| `POSTGRESQL` | PostgreSQL. |

### DatabaseWireProtocol

Wire protocol for a managed database type.

| Value | Description |
| --- | --- |
| `POSTGRESQL` | PostgreSQL. |

### 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. |

## Referenced by

- [`database_price`](https://docs.sparecores.com/schemas/tables/database_price.md)
