Skip to main content

Gold Layer Schema

The Gold layer follows a star schema optimizing storage cost and query performance. Each aggregation type (histogram, histogram2d, statistics) has its own fact/dimension pair linked by visual_id. Fact tables join back to containers via container_id and to events via event_id or event_instance_id.

All gold-layer table names are prefixed with the configured table_prefix from the report's sink config (e.g. with table_prefix: "my_report" the histogram fact table becomes my_report_histogram_fact).

container_id type

The container_id type shown in the diagrams and tables below (long/int) is the typical default. The gold layer inherits whatever container_id type your silver tables use (e.g. string) — fact and dimension rows are written with the source container_id type, not cast to a fixed one. See Silver Layer Schema.

Entity-relationship diagram

The measurement_dimension table also contains additional columns selected dynamically from config.measurement_dimensions at run time — only container_id, config_hash, and _created_at are guaranteed.


Fact tables

TableKey columnsDescription
{prefix}_histogram_factcontainer_id, visual_id, event_id, bin_id1D histogram bin values per container.
{prefix}_histogram2d_factcontainer_id, visual_id, event_id, x_bin_id, y_bin_id2D histogram bin values per container.
{prefix}_stats_aggregator_factcontainer_id, visual_id, event_instance_id, channel_name, aggregation_labelStatistics values per signal, event instance, and container.
{prefix}_event_instance_factcontainer_id, event_id, event_instance_idMaterialized event occurrences with start/end timestamps.

Dimension tables

TableKey columnsDescription
{prefix}_histogram_dimensionvisual_id, report_idHistogram metadata (name, bins, signal info, units).
{prefix}_histogram2d_dimensionvisual_id, report_id2D histogram metadata (axes, bins, signal info, units).
{prefix}_stats_aggregator_dimensionvisual_id, report_idStatistics metadata (signals, aggregation labels).
{prefix}_event_dimensionevent_id, report_idEvent definitions (name, expression, required channels).
{prefix}_measurement_dimensioncontainer_idContainer metadata. Always carries container_id, config_hash, _created_at; additional columns are populated from config.measurement_dimensions.
{prefix}_channel_mapping_resolution_dimensioncontainer_id, channel_id, channel_aliasResolves each channel alias to its physical channel per container (physical join keys, alias priority). Written only when the report uses aliased selectors. The source_unit / target_unit columns are present only when a config.unit_conversion_table is configured.

The channel_mapping_resolution_dimension table lets BI consumers join a fact back to the physical channel that an alias resolved to: join on (container_id, channel_id, channel_alias). The join-key, channel_alias, priority, and source_unit / target_unit column names follow the channel_mapping solver config — see the column reference there for how each maps to the alias and metrics tables.