|
| 1 | +# Promscale Data Storage |
| 2 | + |
| 3 | +This document provides the foundations to understand how Promscale stores data. |
| 4 | + |
| 5 | +## Metrics |
| 6 | + |
| 7 | +The most important components of the metric data model are as follows: |
| 8 | + |
| 9 | +``` |
| 10 | + _prom_catalog |
| 11 | + ┌───────────────────────────────────────────────────────┐ |
| 12 | + │ │ |
| 13 | + │ ┌──────────┐ ┌──────────┐ ┌──────────┐ │ |
| 14 | + │ │ metric │◄──────┤ series ├─────►│ label │ │ |
| 15 | + │ └──────────┘ └────▲─────┘ └──────────┘ │ |
| 16 | + │ │ │ |
| 17 | + │ series_id │ |
| 18 | + └───────────────────────────┼───────────────────────────┘ |
| 19 | + │ |
| 20 | + ┌─────────────┴─────────────┐ |
| 21 | + │ prom_data.<metric_name> │ |
| 22 | + └┬──────────────────────────┘ |
| 23 | + └─ BTree (series_id, time) INCLUDE (value) |
| 24 | +``` |
| 25 | + |
| 26 | +The `_prom_catalog` schema contains metadata tables which describe `metrics`, |
| 27 | +`label`s, and `series`. Each metric stored in the system is represented through |
| 28 | +an entry in the `metric` table. The `label` table contains (key, value) pairs |
| 29 | +with identity. The `series` table represents the combination of a `metric`, and |
| 30 | +a list of `label`s. |
| 31 | + |
| 32 | +The actual metric data is stored in a TimescaleDB hypertable (one per metric) |
| 33 | +with the same name as the metric (assuming the metric name is shorter than 62 |
| 34 | +characters, otherwise it is truncated). These hypertables are in the |
| 35 | +`prom_data` schema. Each row in the hypertable stores the timestamp, series id, |
| 36 | +and the observed value. |
| 37 | + |
| 38 | +Additional to the data in the hypertable, we build a covering btree index over |
| 39 | +the pair of (series_id, time), including the observed value. |
0 commit comments