Skip to content
This repository was archived by the owner on Apr 2, 2024. It is now read-only.

Commit 56bb291

Browse files
committed
Add documentation of Promscale metric data model
1 parent a5026cc commit 56bb291

File tree

1 file changed

+39
-0
lines changed

1 file changed

+39
-0
lines changed

docs/data-model.md

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
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

Comments
 (0)