Eloverblik

Dokumentation · Beregningerne

The named queries (B15)

POST /api/query/{id} with {"params": {...}} runs one named query of docs/architecture/phase-1.md §10.4 and answers with the response of §10.2. The runner, the catalogue and the SQL are in services/api/src/elo_api/analytics/ (catalog.yaml and queries/); the runner and catalogue are adapted from S&OP's analytics module without audiences (services/api/VENDORED.md). A page contains no SQL and no arithmetic beyond formatting: every figure, variance and ratio is a column of a query. Nothing is cached; every request runs its query. report.footprint is B12b's (below, and docs/validation.md).

The guard of the local mode (Host, X-Elo-Client: web, elo_api.guard) comes before any route. The body is JSON, at most 16 KiB, nested at most 8 deep; the parameters are {"params": {...}} and nothing else.

Parameters (§10.1)

ParameterMeaningValuesDefault
pthe period2026-01-01..2026-03-31, one day 2026-03-29, or a preset ytd, mtd, 7d, 30d, 12m that ends at the frontier of the selectionrequired where a query has a period
mpmetering pointsa list of mp_id (the database's integer key, never a GSRN)the account's E17 roots. A figure's query takes E17 roots only (422 not_a_consumption_root: a parent and its children are never added, L2); the mp.* queries take exactly one point of the tree
selthe selection (B54, phase 2 §3.5)an object of dimension key (company, type, area, net, settle, read, asset, status, heat) to a list of values; {} is no selection. Taken by overview.cards, overview.months, overview.mp_variance, development.series, consumption.weekday_hours, meta.selection (B67a), mix.structure and mix.series (B59), mix.profile (M4) and mix.hours (M5a), always beside mp; no other query takes itnone: every E17 root. See "The selection" below
mmethodthe codes of ref.method that are available (LB-PA-125, LB-PA-200, and from B83 LB-MU-125, the municipality method; LB-MU-200 is reserved and 422 invalid_parameter until its row is made available). A method that is offered is answered (B84): every query that takes m answers under LB-MU-125 with ok, empty or unavailable and a reason the pages can say (below, "The municipal split in the queries"), never a 422 and never the price-area figure under the municipal method's namethe first of meta.context's methods: the install's default (B93)
gwpGWP setthe codes of ref.gwp_setAR5
basisdata basisbest, finalbest
cmpcomparison (B55, phase 2 §3.4)py (the previous year), pp (the period immediately before), from:YYYY-MM-DD (an earlier period that starts on that day, 2015–2040), none. See "The comparison" belowpy; none for consumption.weekday_hours (B67: its comparison is a second picture the page asks for)
ggrainauto, quarterHour, hour, day, month (mix.series has day and month; mix.hours has hour alone, so its window is at most 31 days by the 750 points: 32 days are 422 grain_too_fine)auto
bythe parts of the sources' structure (B59)source (the nine groups of ref.mix_group), origin (the connected areas); mix.structure and mix.hours (M5a: the origin of one hour is by=origin over the same window) only (422 unknown_parameter elsewhere)source
blocksthe blocks of report.footprint (B59f)all (phase 1's eight and the sources), emissions (phase 1's eight alone: calc.mix_buckets is not called, the answer carries no basis.mixStatus or mixSource, and the row budget is 5 300 000); report.footprint only (422 unknown_parameter elsewhere). Until B88, a municipal method with blocks=all (and so without blocks) is 422 invalid_parameter: the sources under the municipal split are not answered, and the price area's are never given under its nameall
measuremeasureE01 consumption from the grid, E03 delivered to the grid, ENET E01 − E03, G01 Scope 2 emissions, K01 the cost of the purchase at the day-ahead price, K02 the same of the sale, KNET K01 − K02 (B57). overview.months and development.series take all seven; consumption.weekday_hours takes E01, E03, G01 and K01 (B67, B57; ENET, K02 and KNET are 422 invalid_parameter there, as K03, a card and no measure, is everywhere). See "E03 and ENET", "Cost in the queries" and "The heat map's comparison" belowE01

An unknown parameter, and a parameter another query takes and this one does not, is 422 unknown_parameter, never ignored. A malformed value is 422 invalid_parameter, a missing one 422 missing_parameter, a metering point that does not exist 422 unknown_metering_point, a first day after the last 422 invalid_period. The days a period may name are those of ref.calendar_day, 2015–2040. Errors are {"error", "reason", "detail"?}: fixed texts and parameter names, never a figure. An unknown parameter's name is returned in detail only when it is a plain name (a letter, then up to 31 letters, digits or _); the client's other text is never sent back. A key repeated in the body (two p, two params) is 422 invalid_request ("a key is repeated in the body"), never the last one kept.

The response (§10.2)

{ "queryId": "development.series", "columns": [...], "rows": [...], "grain": "month", "state": "ok",
  "reason": "...", "method": {"code": "LB-PA-125", "geography": "price_area", "gwp": "AR5", "co2eBasis": "gases", "dataBasis": "best"},
  "comparison": {"kind": "py", "code": "PY", "from": "2025-01-01", "to": "2025-03-31"},
  "basis": {"dataThrough": "2026-11-12", "frontierState": "ok", "coverage": 0.998,
            "factorStatus": {"final": 0.0, "preliminary": 0.71, "initial": 0.21, "pending": 0.08, "noPriceArea": 0.0, "noMunicipality": 0.0},
            "factorSource": "generated", "matched": {"hours": 7512, "hoursInPeriod": 7680, "excludedReadings": 96,
            "excludedFactor": 72, "reason": null}, "boundary": "physical"},
  "scale": {"kWh": {"max": 1234.5}}, "truncated": false, "dataVersion": 4711, "calcVersion": "1.0.0" }

meta.context and the accounts' states (N6)

Rows are the metering points of every account (mp_id, type, alias, address, parent_mp_id). methods and gwpSets list codes, the first the default. B93: methods stays the list of codes of the available methods, the install's default first (ref.method.is_default, then by method_id; ELO_DEFAULT_METHOD, LB-PA-125 unless set, is installed by migrate and refuses the start when it is not an available method), and a request without m is answered by that first one. Beside it methodInfo has one object per listed method, in the same order: {"code", "geography" (price_area or municipality), "allocation" (1 or 2), "name" (the Danish name of ref.method)}. The shell groups its method control by geography. B54: dimensions lists the dimensions the roots fall into more than one value of, and hasExport says whether an E17 root has a child of role 3 (below, "The selection"). B74: accounts lists the accounts with their company, state and days left (below, "The accounts"). B100: product is {"version"}: the release that answers (ELO_VERSION, which the image sets from the tag, X.Y.Z; 0.0.0+dev for a build without one). It reads no table. The pages' footer says "Version X.Y.Z", and "Udviklingsversion" for any version that begins 0.0.0. readingSource (B15b, B16av-12, B15bx-01) says where the stored readings came from, from what the database records about its loads and never from an environment variable or a metering point's number. Each day of readings points at the response that is its evidence (raw.fetch, source): 1 Eloverblik, 9 the generated demo, 8 the replay of a capture. A replay is not Eloverblik by being a replay: it persists the origin the capture records about where it was made (raw.fetch.origin, migration 0184, allowlist eloverblik / generated; elo_worker.replay.capture_origin): a capture made at the API's address (manifest.json api_base_url) is eloverblik, one made at another recorded address (a rehearsal; the generator's capture, which records http://generated.invalid/…) is generated, one that records none, and every fetch of an earlier load, has no origin: not known. The value set:

readingSourceWhen
generatedevery load is generated: source 9, or a replay with origin generated
eloverblikevery load is Eloverblik's: source 1, or a replay with origin eloverblik
mixedboth of those (a database holds the demo's data or the owner's, never both, so it is a fault that is shown)
unknownany load has no recorded origin (a replay without one), alone or beside known ones: a page never claims an exclusive origin the database does not record for every load
noneno recorded load behind any day

The API's role reads nothing in raw: three booleans leave through calc.reading_source() (0183, replaced in 0184, SECURITY DEFINER, no row of raw.fetch and no count). The pages' source line says "genererede data (demo), ikke fra Eloverblik" for generated, and for unknown "målinger af ikke registreret oprindelse", which names neither origin; the response never says "Eloverblik" itself. account is {state, tokenExpiresInDays}, read from ingest.source_account, ingest.token_notice and ingest.mp_state afresh by every request; the comparison with 60 days is made in the query. tokenExpiresInDays is the whole local days from today to the day the refresh token expires (null when it is not known). From B74 account is the install's state: the worst of the accounts' states (phase-2.md §6.3), with that account's days; the state multiple_accounts of phase 1 no longer exists and no query returns it.

The accounts (B74)

accounts is a list with one entry per account, in the order of account_id, each {company, state, tokenExpiresInDays}: the company is the name of the account's company, the label the owner gave it (core.company.name: for a private account, which stores no free text, that is the account's label, and then it is the company's name), the state is the account's own and tokenExpiresInDays its days left. Nothing else of an account leaves: no label as such, no fingerprint, no token file, no generation, no error code, and nothing of a row of ingest.token_notice but that it exists. A database without an account row has account {state: "no_account", tokenExpiresInDays: null} and accounts: [] (status 200, never a 500).

An account's state is the first that applies:

Account stateWhen
token_neededthe account is invalid (status 3), its refresh token has expired, or the worker may not call with it: a row of ingest.token_notice names the account (its token file refused or gone, B76); the row's text is never read
no_accessnone of the account's own metering points (core.metering_point.account_id) can be read: every one has current_access FALSE (not known is not "no", B19). With several accounts (B74f) only an account that owns points can be no_access: an account added a minute ago, whose first list has not run, owns none, and an account whose every listed point another account listed first (B76) owns none either; each is ok, and make status says what waits. One account alone keeps phase 1's rule word for word: no point it can read is no_access
token_expiringthe token expires in 60 days or less (60 is expiring, 61 is ok)
okotherwise, also with no expiry known

The install's account.state is that of the most urgent account, in the order token_needed, no_access, token_expiring, ok; among equals the account whose token expires first, then the lowest account_id; the days are that account's. Besides, no_account is the state of a database with no account row. The state of an account changes no figure: the other companies' figures stand (the pages name the company, docs/pages.md).

The selection (B54)

sel is an object of dimension key → list of values: the roots a figure is made of are the E17 roots that have, for every key given, one of the values listed (alternatives within a key, all keys must hold), and mp, when given, narrows them further. The keys are those of calc.root_dimensions() (migrations 0195 and 0305), which classifies a root by its current master data version and its current price area (the latest-started core.mp_geo period) for every period: the history of a point's class is not followed. This is the selection only; every calculation keeps reading the price area valid on each local day.

KeyDimensionA value isNamed from
companycompany (B74, label "Selskab")the id of the company of the account that owns the root (core.metering_point.account_id; a root a second account lists as well stays with its owner): the digits of core.company.company_id, never a CVR number, a token's label or a fingerprintcore.company.name: the label the owner gave the company ("Egen konto" for the .env account)
typetypeE17, E18ref.mp_type.name_da
areaprice areaDK1, DK2ref.price_area.name_da
netnet settlement groupthe code (0, 1, …)ref.code list net_settlement_group
settlesettlement methodD01, E02ref.code list settlement_method
readreading occurrencePT1H, PT15Mref.code list meter_reading_occurrence
assetasset typethe coderef.code list asset_type
statusphysical statusthe coderef.code list physical_status
heattax reductiontrue (Elvarme (reduceret afgift)), false (Uden)fixed in providers/dimensions.sql

A root with no value (no master data version, or the field not stated) has the value unknown, named "ikke oplyst", which counts as a value in sel and in the counts below. A value is 1 to 32 letters or digits; a dimension key and values are never echoed in an error. A stored code outside that form (master data does not constrain these columns) is classified as unknown, so a page is never offered a value that the contract then refuses. A root of status 4 (invalid ID) is in no dimension's count and no selection, as meta.context's list leaves it out. sel: null is absent, as null is for every optional parameter; {} is no selection too.

meta.context adds two members to the response:

{ "dimensions": [ { "key": "area", "label": "Prisområde",
                    "values": [ {"value": "DK1", "name": "Vestdanmark", "roots": 3},
                                {"value": "DK2", "name": "Østdanmark", "roots": 1} ] } ],
  "hasExport": true }

A dimension is offered only when the roots hold two or more values of it (unknown is one): in a database with one root dimensions is []. The counts are of every root the database holds, of any type (the type dimension offers E18 when there is one), the values stand largest first with "ikke oplyst" last, and the dimensions in the order of the table above (the company first, the widest cut). company is offered only with more than one company (the rule of every dimension), so the owner's install, one company, offers none; with two it is offered with each company's name and number of roots and narrows every figure of a query that takes sel. The default selection, none, is every E17 root of every company, as for every dimension. hasExport is whether an E17 root (of mp, when mp is given) has a child of role 3.

meta.selection: how many roots the selection holds (B67a)

meta.selection answers one row, roots: the number of E17 roots that sel and mp select, taken as every query of the selection takes them (the runner resolves them with calc.select_roots(sel, mp); queries/meta/selection.sql counts the same roots). With neither, every E17 root. It is what the shell's title line names (B60): a page never counts the roots itself. It takes mp and sel only: a period, a comparison, a measure or a grain is 422 unknown_parameter. **A selection without an E17 root** (an empty intersection, a value no point has, type: ["E18"] alone) answers state empty, reason no_consumption_point, no row, as every query of the selection; an E18 in mp is 422 not_a_consumption_root. It reads no reading, has no row budget and carries no figure: a count of the database's keys, with no identifier of a point, a meter or a person in it. Tests: services/api/tests/test_queries_b67a.py (through HTTP on the demo organisation).

E03 and ENET

overview.months and development.series take measure E03 and ENET besides E01 and G01 (phase 2 §3.1). Both read ts.day_load: no reading, no row budget, no emission, no factor.

Grain and budget (§10.3)

g=auto is the finest grain the query has with at most 750 points per series: mp.series, mp.emission_intervals and mp.cost_intervals (quarterHour, hour): quarter-hours up to 7 days (676 points when the window holds 25 October), hours up to 31 days (745 for 1–31 October 2026); development.series (day, month): days up to 750 days, months beyond; overview.months is by month. A window no grain of the query fits is 422 grain_too_fine, like an explicit finer grain, with detail: {grain, maxPoints, longestWindow: {from, to}} (the longest window from the first day that the grain allows). Nothing is thinned. A grain the query does not have is 422 invalid_parameter.

| energy.split (B68, B68f) | 1 000 000 | it reads what KNET reads, the roots' series and the export children's, both periods (providers/budget.sql counts it as KNET: the catalogue's budget_measure), and reads them twice with a comparison: once for the cost (calc.cost_buckets) and once for the energy's like-for-like cells (calc.consumption_matched, B68f). The provider counts each reading row once, so the number is KNET's 2 000 000 halved: a year of the demo's 18 roots with the previous year (437 085 rows) takes 3.1 s, 7.2 µs a row, KNET 1.5 s, 3.5 µs a row ("Cost after B68"), so 1 000 000 is about 7 s of 30, as KNET's 2 000 000 is. Without a comparison the second scan does not run (calc.consumption_matched returns at once) and the budget is conservative; not measured at 50 or 80 roots |

Not shown to answer inside 30 s under load (P1, P1v-01, P1v-02): the cards' 1 200 000 and overview.mp_variance G01's 2 000 000. The cards at 1 191 360 rows (a year of 50 bulk roots or 68 hourly ones, against the previous year): 35.5 – 55.9 s in the database at load 34 – 80 (P1's report, section 4), cancelled at 30 s in 3 of 3 rounds at load 24 – 35 (the read, P1v), and 34 roots (595 680 rows) cancelled at load 86 – 90; their edge is not known. G01's ranking at its largest admitted request (114 hourly roots' year, 1 997 280 rows): 15.8 – 20.2 s at load 24 – 41, 18.7 – 25.0 s beside a second such request, 27.2 s at load about 96 (P1v); P1 measured 9.9 – 13.6 s for 1 191 360 rows at load 46 – 74. These loads were other workers' runs on a shared machine, so no budget was changed from them: python -m elo_devtools.budget_edge (make budget-edge) measures the largest request each budget admits (its rows, seconds and temporary blocks) for the lead to run on a quiet machine and set the numbers from. Such a request writes temporary files: about 1 GB for G01's at 2 000 000 rows (124 491 blocks written, work_mem 4 MB), and the API's five connections may run five at once; no temp_file_limit is set (P1's report, section 4, has the recommendation).

B84: under a municipal method the budget of a response that carries emissions is its number times the entry's municipal_budget_factor (0.90 for overview.cards, 0.83 for overview.months and development.series, 0.82 for the heat map's G01, 0.69 for report.footprint), rounded down to a hundred thousand: "The municipal split in the queries" below has the measurement.

ELO_ROW_BUDGET, when it is set, is every query's budget instead: one number for all, as a test or the measurement's "budget off" (B73's tool) sets it. A set value replaces a query's own number upward too: ELO_ROW_BUDGET=2000000 takes the cards' guard (1 500 000) away, and lowers the heat map and the report to 2 000 000. The variable is for a measurement; it is set nowhere in the stack's configuration.

Which intervals are expected (B15b)

An interval after a series' data-through date, or before the first day the API can serve for it, is not "missing". Every coverage figure counts missing among the expected intervals only; mp.series and mp.emission_intervals say, per interval, whether it is expected, and per series where the expected range starts and ends. Nothing that is missing inside the range disappears by this. The rule is calc.series_expected (migration 0182), one range of local days per series:

Rule
From (expected_from)the earlier of ingest.mp_state.readable_from (the first day the API can serve, §6.3) and the series' first stored day (what every figure counted from since B15v2-05: a stored day before readable_from counts). NULL when both are NULL: the series has no range
To (expected_to), a metering point that is valid (status 1 and current access not false, the series' own or else its root's; not known, or no ingest.mp_state row, is valid, because only the daily run writes current_access: after a first load or a capture an unknown would read every point as ended at its last stored day, and a stalled series would never become missing)the greater of the series' own last stored day (ts.day_load with points) and the day before the daily run's window starts, today − DAILY_WINDOW_DAYS − 1 (elo_core.plan.tiling, 14: the runner passes it, :daily_window_days). The days the daily run still asks for (from today − 14) are expected through the series' own last day only, so a child that lags its parent is "not yet delivered", not missing; a day older than the window that is still not stored is missing
To, a metering point that is not validits last stored day, or the day the database records that it ended when that is later: no longer listed (status 2) the local day of core.metering_point.last_seen_at, no current access (status 3) ingest.mp_state.daily_ok_through (the last day the daily request was answered); the days between are missing. The database records nothing for an invalid ID (status 4) or a point with status 1 and current access false: the last stored day

today is the server's, the local day in Europe/Copenhagen of the request's clock, injected by the runner: it is not a parameter (a client that sends today gets 422 unknown_parameter, as for any unknown one). The day a series is expected through changes at Danish midnight, not at the process's or the client's.

An interval's not_expected_reason is before_readable (before expected_from, or the series has no range), not_yet_delivered (after expected_to on a valid point) or ended (after expected_to on a point that is no longer valid); NULL when it is expected. A stored interval is always expected (the range reaches both its first and its last day).

CaseRule appliedTest (test_queries_b15b.py)
A new series: first data on 5 June, readable from 5 June1–4 June are before_readable, not missing; from the 5th they are expectedtest_a_new_series_is_expected_from_its_first_readable_or_first_stored_day
A stored day before readable_from (a relation lost and anchored anew)the range starts at the stored daytest_a_stored_day_before_the_readable_day_is_still_expected
A hole between two stored daysinside the range: missingtest_a_hole_between_two_stored_days_stays_missing
A refused window (a chunk outside or not_available)by position: between served days it is inside the range and missing (the API served on both sides; mp.ingestion reports the refusal); before the first readable day it is before_readabletest_a_refused_window_is_missing_inside_the_range_and_not_expected_outside_it
The newest 14 daysafter the series' own last stored day and inside the daily window (30 October to today, on 13 November): not_yet_delivered; up to the day before it: missingtest_the_newest_days_are_not_yet_delivered_and_older_ones_are_missing (the boundary day is held to today − DAILY_WINDOW_DAYS, the first day the daily run asks for)
A parent with childreneach series is expected through its own last day inside the window: a child a few days behind is not yet delivered; a child that stopped before the window is missing from its last day to the day before the windowtest_a_child_that_lags_its_parent_is_not_yet_delivered_and_one_that_stopped_is_missing
Ingestion has failed for 10 days on a valid pointnot yet delivered until its day is older than the window (the 15th day after it), then missing; the pages do not read as complete meanwhile (they say "Målinger forventet til og med <expected_to>" and the not-yet-delivered share; "Data til og med" is the frontier's phrase alone)test_ingestion_that_has_failed_for_days_is_not_yet_delivered_until_the_window_has_passed
An ended one: not validthrough its last stored day; or through the day the database records, the days between missing; afterwards endedtest_an_ended_series_is_expected_to_its_last_stored_day_or_the_day_the_database_records
Access not known (status 1, no mp_state row or current access NULL, as after a first load or a capture)valid: not yet delivered inside the daily window, missing once older, never endedtest_a_point_whose_access_is_not_known_is_valid_so_a_stalled_series_becomes_missing
A period wholly outside every range, or a series with no rangezero expected minutes: coverage is NULL (i.r., reason not_expected), never 100 %test_zero_expected_minutes_is_no_coverage_never_100_percent

Aggregates. consumption_buckets counts a series-day's minutes as expected only inside the range. What is outside it is its own quantity, never silent: ac_not_expected_minutes and cp_not_expected_minutes (and ac_not_yet_delivered_minutes, the part of the first that a valid point may still deliver, and ac_outside_range_minutes, the rest of it: before the first readable day or after the point's data ended, computed in SQL as not expected minus not yet delivered so that no page counts the pending days twice, B15bx-03). For every aggregate the minutes of its days over the selected series are **stored

What does not change. The eligibility of §9.3 and every emission figure (calc.emission_buckets, calc.emission_matched) read readings, not expectations: the golden cases (test_like_for_like_case_through_overview_cards, B12a's M_01…M_16) and test_emission.py pass unchanged. report.footprint keeps its expected_hours and complete: they say whether the readings of the asked period are complete (a report period reaching past the data is not complete), not a coverage figure.

The comparison's names (B66)

The comparison's columns have one name in every query: cp…: cp, cp_from, cp_to, cp_matched, delta_cp, delta_cp_pct, delta_cp_total, delta_cp_total_pct, strip_delta_cp, strip_delta_cp_pct and the cp_… quality columns (cp_solid_amount, cp_provisional_amount, cp_missing_minutes, cp_incomplete_minutes, cp_pending_factor_minutes, cp_not_expected_minutes). Phase 1 named them py…; B66 renamed them, with the figures unchanged: services/api/tests/test_queries_b66.py asks every query of the catalogue, with cmp=py and cmp=none, and compares each answer value for value with the answers written before the rename (tests/fixtures/b66_before.json), the names of the one a mapping in the test. The columns of the functions calc.consumption_buckets, calc.emission_buckets, calc.consumption_matched and calc.previous_year_buckets (B55: calc.comparison_buckets) were renamed with them (migration 0210); the rule of the previous year (calc.previous_year_date, calc.previous_year_last) is unchanged.

A column names its role, the response its code. A column is AC, CP, ΔCP or ΔCP % (the scenario of its entry in columns). A response to a query that takes cmp carries, with a comparison, the block "comparison": {"kind": "py", "code": "PY", "from": <first day>, "to": <last day>}: kind is the comparison asked for (py, pp or from), code what a page prints in the place of CP (PY for py, PP for pp and from:), from and to the comparison's own first and last day (calc.comparison_period of the resolved period, below: for py the previous year of the period's first day and the last previous-year day of its last). The block is absent when there is no comparison to name: with cmp=none, in the response of a query that takes no cmp, when a preset period cannot be resolved (empty, no_data: no day to count back from) and when the selection selects no point (empty, no_consumption_point): the days of the comparison are worked out only for a period that is known. cmp omitted is cmp=py, but on consumption.weekday_hours, where it is cmp=none (B67: the heat map without a comparison is B20's, value for value). basis.matched is there with every comparison.

The comparison (B55)

The comparison period is an earlier period that takes its length from the period (phase 2 §3.4): a variance between periods of free lengths would be mostly the calendar. cmp is one of:

cmpThe comparison periodDays correspondCode
pythe previous year, below ("The previous year"), unchangedby month and dayPY
pp, the period whole calendar monthsas many whole months immediately beforeby the position of the month and the day of the monthPP
pp, any other periodas many local days immediately beforeby offset: day k with day kPP
from:<date>, the period whole months and the date a first of a monthas many whole months from that dateas pp for whole monthsPP
from:<date>, otherwiseas many local days from that dateby offsetPP

Where it is computed. calc.comparison_period(cmp, from, to, cmp_date) resolves a comparison into its first and last day and a shift: whole months (py 12) or days, never both; the Python reference is elo_core.comparison, which services/api/tests/test_queries_b55.py holds it to. The functions the queries call (calc.consumption_buckets, calc.consumption_matched, calc.emission_buckets) take the comparison as their parameters p_cmp (py, pp, from, none) and p_cmp_date (the date of from:); calc.emission_matched, which no query calls, takes it as cmp (py, pp, from; not none) and its first day cmp_date_from (docs/emission.md). Each reads the comparison's own days, count a comparison day in greatest(day + shift, first day) and key its hour cells by day + shift where that is the same day of the month; with py (a shift of 12 months) every expression gives what phase 1's gave, and B66's fixture holds every answer to it. calc.comparison_buckets gives each bucket's comparison days (cp_from, cp_to). calc.consumption_matched has a seventh, defaulted, parameter p_export (B68f, migration 0265: the export children's series, for energy.split's sold); calc.consumption_matched, calc.emission_buckets and calc.emission_matched refuse a pp or from: comparison that does not end before the period by themselves (22023); calc.consumption_buckets and calc.comparison_buckets do not, and rely on their caller (the runner's 422 comes first).

The previous year

One rule, for a period and for every bucket (the lead's ruling on B15v2-01): **days correspond by month and day, and the last day of February corresponds to the last day of February.** The previous year of a day is the same month and day one year earlier, except at the end of February:

DayIts previous year
28 February of a year whose previous year is a leap year (28 February 2025)28 and 29 February of that year (28–29 February 2024)
29 February (29 February 2028)28 February of the year before (28 February 2027)
28 February of a leap year (28 February 2028)28 February of the year before (28 February 2027)
28 February of any other year (28 February 2027)28 February of the year before (28 February 2026)
Every other daythe same month and day one year earlier

A period's previous year is the union of its days' previous years: from calc.previous_year_date of its first day to calc.previous_year_last of its last. So the previous year of 2025 is the whole of 2024, to the last decimal what the page shows for 2024; the previous year of February 2025 is the whole of February 2024, whether February is the period, a row of overview.months or development.series, or a month of a card's strip (one figure for one month); the one-day period 28 February 2025 compares with two days; 29 February 2024 alone compares with 28 February 2023, and 29 February–31 March 2024 with 28 February–31 March 2023.

In buckets each previous-year day counts once, so the buckets add up to the period at every grain: in the bucket of its own month and day a year later, 29 February in that of 28 February, and a day before the period's first day (28 February, for a period from 29 February) in the first bucket. One day is the previous year of two: 28 February 2027 is that of 28 and of 29 February 2028. Counted once, it is in the bucket of 28 February when the period holds that day; in a series by day that holds both, 29 February then holds no previous-year day (cp NULL, cp_from NULL, reason no_counterpart), and as the first day of a period it holds 28 February 2027.

Every row with a previous-year value names the previous year's own days (B15v2-02): cp_from and cp_to, the first and last previous-year day the row holds, inclusive (a card and overview.mp_variance: the period's), NULL with cmp=none and where the row holds none. A page marks a row whose previous year holds more or fewer days than the row ("inkl. 29. februar") from these two dates alone, with no calendar rule of its own.

Only the like-for-like variance (G01, G16) drops hour cells without a counterpart (29 February, the DST hours), and its count says so: hours_in_period − matched_hours − excluded_readings − excluded_factor cells have none. So in a leap year a card's total variance and its like-for-like variance differ; both are returned, named apart: delta_cp_total (and delta_cp_total_pct) is ac − cp over all days of both ranges, delta_cp is the variance the card shows (like-for-like for G01 and G16, equal to delta_cp_total for E01 and coverage).

A month figure is the sum of the period's local days of that month, so the first and last month of a period are partial.

The figures

The weekday-hour cells (B20)

consumption.weekday_hours (page A1 Forbrug, the heatmap) returns 199 rows told apart by kind: the 168 cells (weekday, ISO, Monday 1 to Sunday 7, and clock_hour 0-23 of the local day, Europe/Copenhagen), the 7 weekday margins (the 24 hours of a weekday; clock_hour NULL) and the 24 hour margins (a clock hour over the 7 weekdays; weekday NULL). ac is the **mean of the measure** (E01: consumption in kWh) of that hour on that weekday over the days of the period that have the hour with data; kwh is B20's column, the same where the measure is in kWh and NULL for G01, kept until the page reads ac (B62). It takes p, mp (E17 roots) and sel (B54), no grain: a g is 422; measure, cmp, m, gwp and basis from B67 (next section, which also says what ac is for E03 and G01). A figure no root has an hour for has ac and kwh NULL and roots 0, never a zero; a period in which no hour counts has no row at all (state empty, never 168 cells of zero).

The heat map's comparison (B67)

consumption.weekday_hours takes cmp (every kind of B55: py, pp, from:<date>, none; default none), measure (E01, E03, G01; default E01) and, for G01, m, gwp and basis (phase 2 §3.4, §4). **It is not the like-for-like comparison:** no cell of the period is matched to a cell of the comparison (the same date a year earlier is another weekday, so matched cells would set a Thursday against a Wednesday). The comparison period's 168 cells and 31 margins are computed **by B20's rule over the comparison's own days**, and the variance of each is a difference of means:

FigureRule
Which hours countEligible by §9.3 (above). E01 the roots' own series. E03 the series of the roots' export children (role 3, D06), each counted for its root: a child's hour is tested on its own, and the root's hour counts when every export child of the root that has a reading on that side has it eligible; its amount is their sum. A root without an export child has no mean, and a selection with none is unavailable, no_export. G01 the CO2e (g) of the roots' hours whose readings are eligible and which have a factor for every interval, under m, gwp, basis (the lead's ruling to B20); the response carries method and the factor status, and no factor at all is unavailable, no_factor
A side's cell or marginB20's: per root the mean of its own eligible hours of the cell (a margin: of the weekday or the clock hour, Σ amount ÷ hours, never a mean of cell means), summed over the roots that have one. The period's in ac and B20's columns (roots, roots_expected, root_hours, root_hours_expected, min_root_hours, data_days); the comparison's in cp, cp_roots, cp_roots_expected, cp_root_hours, cp_root_hours_expected, cp_min_root_hours, cp_data_days, each side by its own days: the repeated hour of a 25-hour day counts twice in its clock hour and the missing hour of a 23-hour day not at all, on whichever side the day falls
The varianceOver the roots that have a mean on both sides (roots_matched): ac_matched and cp_matched, the sums of those roots' period and comparison means; delta_cp = ac_matched − cp_matched (6 decimals, per hour, in the row's unit) and delta_cp_pct = delta_cp ÷ cp_matched (9 decimals, NULL when cp_matched is not above zero), both from the unrounded sums. A root with a mean on one side only is in that side's figure and not in the variance: never a rise or a fall of its whole mean. No root on both sides is roots_matched 0 and the variance NULL (i.r.)
What the page readsBoth sides with their roots and hours, and roots_matched: a cell or margin whose roots_matched is below roots or cp_roots carries the missing symbol (B62 draws it)

The worked example (§3.4, its second half), the first test of the reference (libs/core/tests/test_weekday_hours_reference.py) and of the query (services/api/tests/test_queries_b67.py): over three weeks on each side (pp by offset: 1–21 June 2026 against 11–31 May), root A's Mondays' hour 08 has 4 and 6 kWh and one missing value in the period (mean 5,0 over 2 hours) and 3, 3 and 6 kWh in the comparison (mean 4,0 over 3 hours). Root B has a mean of 2,0 in the period and no eligible hour of the class in the comparison. The period's cell is ac 7,0 (roots 2), the comparison's cp 4,0 (cp_roots 1); roots_matched 1, ac_matched 5,0, cp_matched 4,0, delta_cp +1,0 kWh per hour, delta_cp_pct 0,25; 1 of 2 roots, so the cell carries the missing symbol. B's 2,0 is in the period's cell and in no variance.

Cost in the queries (B57)

Cost is the energy bought at the day-ahead price of the metering point's price area on its local day, in DKK, **without tariffs, taxes and VAT** (phase 2 §3.2; docs/cost.md is the calculation). Three queries carry it, beside the emissions they already carry:

WhereWhat
overview.cardsTwo more rows, K01 (Elkøb til spotpris, DKK, polarity −1) and K03 (the average spot price of the purchase, DKK/kWh, polarity 0), with the figure columns of the other rows, the strip of each, and for K01 volume_effect and price_effect. The COVERAGE row stays: the pages show it as a status line (B61). The rows are in the order E01, G01, G16, K01, K03, COVERAGE
overview.months, development.seriesmeasure K01, K02 (Elsalg til spotpris: the same over the selected roots' export children, each priced by its own price area; polarity 0) and KNET (Netto til spotpris, polarity −1: a lower net cost is better, §3.2's table; ENET is 0) by month, and K01, K02, KNET by day or month on the series, each with the comparison and the variances
consumption.weekday_hoursmeasure=K01: the cost per hour, the 168 cells and 31 margins, with the comparison (B67): "The heat map's K01" below

Every cost figure is a column of calc.cost_buckets (B56; migration 0245), called once per grain the query needs (the cards once by month, summed; a series once for its own grain; K02 and KNET a second time over the export children). A query divides only where this document allows it: a share at 9 decimals (basis.price, unpriced_share) and a relative variance, never a cost; K03's one division is calc.cost_ratio, B56's.

basis.price and priceSource are on every response that carries a cost (the cards, overview.months and development.series with K01, K02 or KNET, and the heat map with K01), the comparison period's rows included, as factorStatus and factorSource are:

"basis": { "price": {"priced": 0.833333333, "unpriced": 0.166666667, "noPriceArea": 0},
           "priceSource": "generated",
           "matched": {"hours": 7512, "hoursInPeriod": 7680, "excludedReadings": 96, "excludedPrice": 72, "reason": null} }

The heat map's K01. consumption.weekday_hours takes measure=K01 (calc.weekday_hour_cells, migration 0255): the amount is the cost in DKK, unit DKK, polarity −1, kwh NULL (a column named kwh never holds DKK). **An hour counts when its readings are eligible (§9.3) and every interval of it has a price**, the rule B20's ruling gave G01 a factor; an hour of four quarters costs what its quarters cost (the worked example's 2,12), so the cells are the cost figures of calc.cost_buckets, hour by hour, and an hour read hourly from the seam needs all four quarter prices. The comparison and the variance are B67's (over the roots with a mean on both sides). basis.price and priceSource come from the statement's own read, so the readings are read once; no matched block.

The row budget (docs/queries.md "Grain and budget"; a number per query, by measure where one query serves several): K01 reads what G01 reads (the roots' series over the period and the comparison's own days); K02 reads the export children's series, KNET both (providers/budget.sql counts them by measure). The cost measures of overview.months and development.series are 2 000 000, G01's number, the default: K01 costs less a row than G01 (1.2 s against 2.7 s for a year of the demo's 18 roots by month, KNET 1.6 s, the cost's two calls being one of 1.2 s and one of 0.4 s over the export children's few rows), so what holds for G01 holds for them; E01, E03 and ENET are never budgeted. The heat map's K01 is 2 000 000 as G01's (0.85 s against 1.02 s for a year). **The cards' number is lowered from 1 500 000 to 1 200 000**: they now read the cost beside the emissions, and ytd takes 4.51 s where it took 3.44 s (a year 5.06 s against 4.07 s; ratio 1.31), so B77's 27 s, nine tenths of the timeout, at 1.57–1.62 M rows becomes 1.2 M rows (1.57 M ÷ 1.31, rounded down to a hundred thousand). It is extrapolated from the demo by the ratio of the cards' seconds, not measured at 50 and 80 roots: that measurement is the lead's (ADR-004, item 4) and may move the number.

The split: bought, sold and net (B68, B68f)

energy.split (A1, p, mp, sel, cmp; no grain, no measure) answers one row per figure: bought, sold and net, in that order (phase 2 §3.1, §4). Each row has its energy (columns kwh_…) and its cost (dkk_…: the energy at the day-ahead price of the point's price area, without tariffs, taxes and VAT, §3.2), with the comparison, the variances and the quality. It calculates nothing: the energy is calc.consumption_buckets of the period (the day summaries, as the E01 card and E03 by month have it: the split's bought equals the E01 card digit for digit, sold E03's), its like-for-like variance is the E01 card's own (calc.consumption_matched, with p_export for sold), and the cost, its like-for-like variance and the unpriced energy come from one call of calc.cost_buckets per side at the period's grain (B56, docs/cost.md).

RowEnergyCostPolarity (kwh_polarity, dkk_polarity)
boughtE01: the selected roots' own seriesK01−1, −1
soldE03: the series of the roots' children of role 3 (D06), each priced by its own price areaK020, 0
netbought − sold, from the two figures as shownKNET: the same in cost0 (ENET), −1 (KNET)

Tests: services/api/tests/test_queries_b68.py and test_queries_b68f.py (B68f: the energy's variance is the card's where the last days have no price; calc.consumption_matched with p_export against elo_core.consumption; a root with no series; the polarity and the counts per figure; the reasons) (the worked example of §3.2: bought 6 kWh and 1,70 DKK, sold 1 kWh and 1,20 DKK, net 5 kWh and 0,50 DKK; the sold row's own like-for-like variance; net with none; no export child; an export child with no reading; an unpriced sale; the budget; and the demo organisation against B56's reference and against the queries beside it).

The point's cost: mp.cost_intervals (B68)

mp.cost_intervals (D1, p, mp exactly one point of any tree, g hour or quarterHour) has the rows of mp.series (one per interval of the window, a gap where nothing is stored, with stored, expected and its reason: "Which intervals are expected") with the price used and the cost of each row, from calc.cost_intervals (B56): it calculates nothing. A root of either type, a child (the export child D06, the import child D07) named directly: each is priced by its own price area on the interval's local day (phase 2 §3.2), and a D06's series is the value of what was sold, at the spot price.

Tests: test_queries_b68.py (the worked example through HTTP: 2,00, −0,30, no price for the hour of three quarters, 2,12 for the quarters, the export child's 1,20; the 745 hours; D15 and D04; the grains; and, on the demo organisation, every row of a week over the seam equal to B56's reference elo_core.cost.cost_series_intervals).

The sources in the queries (B59)

The sources are the grid's mix in the hours of the consumption (phase 2 §3.3; docs/mix.md is the calculation and the wording). The four queries of A4 (mix.structure, mix.series, mix.profile, mix.hours) and the footprint carry them. Every figure is a column of calc.mix_buckets (B58), called once for the grain the query needs (report.footprint twice, by source and by origin); a query divides only where this document allows it: the pending share at 9 decimals and the variance in percentage points, never a source energy or a share of one.

QueryPageParametersRows
mix.structureA4p, mp, sel, basis, cmp, byby source: the nine groups in the order of ref.mix_group.sort (B78: gas "Naturgas" and coal_oil "Kul og olie" where fossil stood), a group without energy a row of zero (0.000000000), never a missing row; by origin: every connected area with energy, the largest first, the lower code among equals, an area ref.code does not know under its own code (known false, name NULL)
mix.seriesA4p, mp, sel, basis, cmp, g (day, month)one row per day or month: E11a and E11b, the energy and share of each group in groups (the order of sort) with the comparison's energy and share on the comparable hours (M1f: cp_kwh_matched, cp_share_matched, the matched cells, as the variance) and over all its own hours (cp_kwh_all, cp_share_all, drawn nowhere in the form), NULL, never zero, where those hours have no mix, the consumption, the consumption of the complete hours, the pending energy and hours, the share of each side's mix that is not final (ac_provisional_share, cp_provisional_share), the comparison's, the two variances in percentage points
mix.profileA4p, mp, sel, basis, cmpone row per clock hour 00 to 23 of the local day over the period, always 24 (M4: calc.mix_buckets by the grain hour): mix.series' figures of a bucket by the class of the hour's own clock hour, the hours of the class (hour_count: the 25-hour day's 02A and 02B two observations of 02, the 23-hour day none; hour_repeated, hour_absent: the days it occurs twice and not at all, what the page names under the axis, manual N29) and the means per hour of the day profile (ac_kwh_per_hour, ac_mix_kwh_per_hour, groups[].kwh_per_hour: each energy over hour_count, 9 decimals, half away from zero); a class with no hour has reason no_hour
mix.hoursA4p (at most 31 days), mp, sel, basis, by, g (hour)one row per hour of the window's local days in time order (M5a: calc.mix_buckets by the grain utc_hour): hour_utc, local_date, clock_hour and occurrence (the short day has 23 rows and no 02; the long day 25, 02A and 02B occurrence 1 and 2, manual N29), the consumption, the consumption in the figures, E11a, E11b, the pending energy, the energy without a price area, ac_provisional_share, and parts (by=source the nine groups, by=origin every connected area with energy in the window: part, name, known, kwh, share); an hour whose mix is pending keeps its row, its consumption known and its parts NULL, reason no_mix (emission_state: rows: a window whose every hour is pending is answered hour by hour, never unavailable as a whole); no comparison

report.footprint's sources (B59, the rows after the eight of phase 1; max_rows 10 became 60). Two calls of the function with no comparison, by=source and by=origin, so that the readings are read twice (a validation can afford it; a page could not, and the pages take one call):

blockunitvalueamount (amount_unit)per_kwh
renewable_share_ex_nuclearfractionE11a, 9 decimalsE07 (kWh)the consumption of the complete hours
renewable_share_with_nuclearfractionE11b, 9 decimalsE07 + nuclear (kWh)the same
source:<group_code>, the nine in sort order (B78: source:gas and source:coal_oil in the place of source:fossil)kWhthe group's energythe same (kWh)–
origin:<connected_area>, each area with energy, the largest firstkWhthe area's energythe same (kWh)–

report.footprint (B12b)

The blocks of Eloverblik's climate report "Dit klimaaftryk" (§9.4; L2) for a period, the selected E17 roots and one method, GWP set and data basis: one row per block, in the report's units. It takes p, mp (roots only), m, gwp and basis, and no comparison or grain (422 unknown_parameter). No page shows it; make validate asks it through the application.

blockunitvalueamount (amount_unit)per_kwh
consumptionkWhΣ every stored quantity of the periodthe same (kWh)–
emissionskg CO2eemissions excluding losses: Σ CO2e × 0.001Σ CO2e (g CO2e)–
distribution_losskg CO2eΣ CO2e × (DFactor − 1) × 0.001(g CO2e)–
transmission_losskg CO2eΣ CO2e × (TFactor − 1) × 0.001(g CO2e)–
biogenickg CO2Σ (CO2origin − CO2) × kWh × 0.001, the consumption's only (R2 §3.4.1 step 7)(g CO2)–
co2_intensityg/kWhamount ÷ per_kwh, 9 decimalsΣ CO2 (g)Σ kWh with a factor
ch4_intensitymg/kWhthe sameΣ CH4 (mg)the same
n2o_intensitymg/kWhthe sameΣ N2O (mg)the same
local_energy (B84, municipal methods only)kWhΣ q × R × 0.01 of the intervals that have both inputs, exactthe same (kWh)–

The municipal split in the queries (B84)

docs/architecture/municipality-method.md §5, without the sources (B88's) and without B93's list of methods (above, meta.context). B83 computes the figures of LB-MU-125; B84 makes every query that takes m answer under it. **Nothing of the price-area methods changes**: services/api/tests/test_queries_b66.py compares every answer of the catalogue under LB-PA-125 with the frozen fixture, value for value, but for the members named here (_b84_part).

QueryUnder LB-MU-125
overview.cardsThe G01 row gains local_kwh (the energy that the municipality's own renewable production covered, the exact sum of q × R × 0.01 over the intervals that have both inputs) and local_share (that over the consumption of the intervals with both inputs, 9 decimals); NULL on every other row and under a price-area method, and NULL, never zero, where no hour has a figure. G16 is the intensity per kWh of the consumption (Σ amount ÷ Σ q, §2.3), as before
overview.months, development.series (G01), consumption.weekday_hours (G01)Computed by the method; the reasons above; noMunicipality in the status. The heat map's cells are the hours that have both inputs
mp.emission_intervalsPer interval also re_share_pct, local_kwh, grid_kwh and pending_reason (no_price_area, no_municipality, municipality_not_loaded, no_local_share, no_factor; NULL when the interval has a figure); NULL under a price-area method, where pending says it. The code of the municipality is in no column. A root with no figure at all is unavailable with its reason and no rows, as a root without a price area always was
report.footprintThe eight blocks by §2.3 and a ninth, local_energy (kWh, the exact Σ q × R × 0.01), returned with blocks=emissions. blocks=all (and so no blocks) is 422 invalid_parameter until B88: the sources of the municipal split are not answered, and the price area's are never given under its name. complete also needs a municipality and a share for every hour with a quantity; reason gains no_municipality, municipality_not_loaded and pending_share (hours of a wanted municipality with no share), the last before pending_factor

The factor on the budget (§5, ADR-004). A query's entry may carry municipal_budget_factor (above 0, at most 1; 1 where absent): under a municipal method (or geo=municipality, B88) a response that carries emissions has the budget it has (its own number, or the default 2 000 000) times the factor, rounded down to a hundred thousand (Query.budget); E01 and E03 of the heat map read no emission rows and keep theirs. The factor is the inverse of the measured ratio where the municipal split takes more than 1,10 times the price area's. Measured through HTTP on analysed tables (ANALYZE after the load, as the product's loader does), the demo's 18 roots, a year to the frontier against the year before, the median of three runs in alternating order, twice (the same ratios to the second decimal), **after B83's fix round** (the price-area path without the municipal joins, so that it costs what it cost before them; before the fix round the ratios were 1.06, 1.11, 1.14 and 1.31, and the price area's seconds about 12 % higher):

QueryLB-PA-125LB-MU-125RatioFactorThe budget
overview.cards4.88 s5.42 s1.110.901 000 000
development.series G01 by month (and overview.months, which is the same file)2.57 s3.07 s1.200.831 600 000
consumption.weekday_hours G01 (not in §5's list: measured beside)1.05 s1.27 s1.210.821 600 000
report.footprint, blocks=emissions1.04 s1.50 s1.440.693 600 000
overview.mp_variance G01 (P1: after migration 0441; the demo's year in the database, best – worst of three, interleaved)2.07 – 3.07 s2.73 – 4.18 s1.31 – 1.360.751 500 000

Like B57's number for the cards, these are an extrapolation from the demo's 18 roots, to be measured at 50 and 80 roots (ADR-004, item 4). The test of the times (test_a_year_of_every_root_under_both_splits_through_http_is_timed) guards against a several-fold blow-up only (1.5 times and a second); the comparison is the one above.

P1v-04: the cards', the months' and the series' factors (0.90, 0.83, 0.83) were derived for the view's ratio and are not re-derived. Migration 0441 (P1) changed calc.emission_buckets, which all three read: its municipal branch now takes 1.31 – 1.36 times the price area's seconds on the demo's year (the ranking's row above), not the 1.20 the months' factor encodes. In seconds both branches are faster than before 0441 (the municipal branch faster than the old price area's), so the budgets admit nothing slower than before; the ratio they encode is not measured. Only the ranking's factor was re-derived (0.75). The read measured the municipal ranking at 85 roots' year at 1.0 – 1.2 times the price area's per row (not interleaved): a bound, not a ratio.

Names of master-data codes (B15b)

mp.master returns every code D1 shows with its Danish name, <code>_name_da, from one table in the database, ref.code (list, code, name_da; the metering point type from ref.mp_type.name_da). A page has no table of names of its own.

Column (code)ref.code.listSource of the names
typeref.mp_typeR1 §5.1 (the types of 0002)
sub_type, physical_status, net_settlement_group, connection_type, disconnection_typesub_type, physical_status, net_settlement_group, connection_type, disconnection_typeR1 §5.8; the values in the saved samples (getdetails.json: E22, 6, D02) are all named
settlement_methodsettlement_methodR1 §5.2 (D01, E01, E02)
reading_occurrencemeter_reading_occurrenceR1 §5.3 (PT15M, PT1H, P1M, ANDET)
unitunitR1 §5.7, which names a unit by its symbol (KWH kWh, KWT kW, MWH MWh, TNE tonne, …); migration 0181 fills the Danish name of the eight units that 0003 left empty
productproductR1 §5.8 (Item8716867000030 Aktiv energi, …)

A code the table does not know, a code without a Danish name and a NULL code give a NULL name: **the page shows the code as it is, never a guess**. services/api/tests/test_queries_b15b.py counts the codes of these lists that have no Danish name (none today: every code of R1 §5 that D1 can show has one) and holds an unknown code to NULL. The grid_area stays a code: its table (ref.grid_area) names the grid company, which no response carries (§7).

What may leave the database

The privacy fault found four times in the reviews of earlier epics was a value kept or returned because its field is allowed, without checking the value. So:

The table below says, for every column of every response, where its value comes from and why it may leave. It is generated from catalog.yaml.

meta.context (all)

The frontier, the metering points, the methods and GWP sets, the accounts' states. Reads: core.metering_point, core.mp_version. Personal columns: alias, address. At most 2000 rows.

ColumnTypeUnitSource: where the value comes from, and why it may leave
mp_idintcore.metering_point.mp_id: the database's key, not an identifier of a meter or a person
typetextcore.metering_point.type_code (E17, E18, D06, ...)
aliastextcore.mp_version.alias of the current version: the name the owner gave the point, for the local user
addresstextcore.mp_version street, number, floor, room, postcode, city of the current version, only when protected_name IS FALSE AND protected_address IS FALSE (N4)
parent_mp_idintcore.metering_point.parent_mp_id

meta.selection (all)

The number of E17 roots the selection holds. Reads: calc.select_roots(). Personal columns: none. At most 1 rows.

ColumnTypeUnitSource: where the value comes from, and why it may leave
rootsintrootcalc.select_roots(sel, mp): the number of E17 roots the selection and the list of points select (every E17 root when neither is given); a count of the database's keys, no identifier of a point, a meter or a person

overview.cards (X1)

The cards of the overview, with their strips. Reads: calc.consumption_buckets(), calc.consumption_matched(), calc.emission_buckets(), calc.cost_buckets(). Personal columns: none. At most 10 rows.

ColumnTypeUnitSource: where the value comes from, and why it may leave
cardtextfixed by the query: E01, G01, G16, K01, K03, COVERAGE
unittextfixed by the query (kWh, g CO2e, g CO2e/kWh, share)
polarityintfixed by the query: consumption, emissions and intensity -1, coverage +1 (notation manual §3); cost -1 (K01, KNET: a lower net cost is better), the price (K03) and the energy sold (K02) 0 (phase-2.md §3.2)
acnumberper rowts.day_load (E01, E03, ENET, coverage) or calc.emission_buckets (G01, G16): the period's own figure; E03 is that of the selected roots' export children (calc.consumption_buckets with p_export), ENET is E01 - E03 where both are
cpnumberper rowthe same for the comparison period (docs/queries.md, 'The comparison'): py the previous year, days by month and day and the last day of February to the last day of February; pp and from:<date> an earlier period of the period's length, days by the position of the month and the day of the month (whole months) or by offset; each comparison day counted in one bucket, the last day of a shorter month taking the later days of a longer one
cp_fromdatecalc.comparison_buckets: the first comparison day this row holds (a card: the comparison period's)
cp_todatecalc.comparison_buckets: the last comparison day this row holds, inclusive (a card: the comparison period's)
ac_matchednumberper rowcalc.emission_buckets, its like-for-like part: the matched hour cells only (E01 on overview.cards: calc.consumption_matched, the same cells without a factor)
cp_matchednumberper rowcalc.emission_buckets, like-for-like (E01 on overview.cards: calc.consumption_matched)
delta_cpnumberper rowac - cp (E01, E03, ENET, coverage); ac_matched - cp_matched (G01, G16)
delta_cp_pctnumberfractiondelta_cp / the comparison value, 9 decimals; NULL when the reference is not above zero
delta_cp_totalnumberper rowac - cp: the total variance, all days of both ranges (the comparison period whole, docs/queries.md 'The comparison'; the previous year with a 29 February in it included). E01, E03, ENET and coverage: equal to delta_cp (ENET's is the difference of the two total variances, named total). G01 and G16: differs from the like-for-like delta_cp when a cell has no counterpart
delta_cp_total_pctnumberfractiondelta_cp_total / cp, 9 decimals; NULL when cp is not above zero, and for coverage
ac_solid_amountnumberper rowtotal minus provisional
ac_provisional_amountnumberper rowE01: the estimated kWh (A03). G01: the emission of intervals whose reading is estimated or whose factor is not Final, counted once
ac_missing_minutesintminexpected minutes of the series-days minus minutes with a quantity (ts.day_load)
ac_incomplete_minutesintmints.day_load.minutes_incomplete (A05)
ac_pending_factor_minutesintmincalc.emission_buckets: stored quantity, price area known, no factor yet
cp_solid_amountnumberper rowas ac_solid_amount, comparison
cp_provisional_amountnumberper rowas ac_provisional_amount, comparison
cp_missing_minutesintminas ac_missing_minutes, comparison
cp_incomplete_minutesintminas ac_incomplete_minutes, comparison
cp_pending_factor_minutesintminas ac_pending_factor_minutes, comparison
provisionalboolprovisional amount x 100 > the figure: more than 1 % of it is provisional (notation manual §9, rule 2)
matched_hoursinthcalc.emission_buckets, like-for-like (h); E01 on overview.cards: calc.consumption_matched (h)
hours_in_periodinthcalc.emission_buckets, like-for-like (H); E01 on overview.cards: calc.consumption_matched (H)
excluded_readingsinthcalc.emission_buckets, like-for-like; E01 on overview.cards: calc.consumption_matched
excluded_factorinthcalc.emission_buckets, like-for-like; NULL for E01 (a consumption needs no factor)
reasontextthe query: no_data, no_price_area, no_factor (the figure is unavailable); missing_readings, no_factor, no_data, no_counterpart (the variance is not applicable; no_counterpart also for consumption, when the row holds no comparison day)
pending_hoursinthcalc.emission_buckets: hours with a quantity and no factor yet
pending_kwhnumberkWhcalc.emission_buckets
pending_sharenumberfractionpending_kwh / the period's consumption, 9 decimals
ac_not_expected_minutesintmincalc.consumption_buckets (B15b): minutes of the bucket's days that no selected series is expected to hold (before its first readable day, after its expected end), never counted as missing; stored + missing + not expected = the minutes of the bucket's days of every selected series
ac_not_yet_delivered_minutesintmincalc.consumption_buckets: the part of ac_not_expected_minutes that is days after a valid metering point's last stored day inside the daily run's window (not yet delivered)
ac_outside_range_minutesintminac_not_expected_minutes minus ac_not_yet_delivered_minutes, in SQL (B15bx-03): the minutes before the first readable day or after the point's data ended, which the not-yet-delivered ones are not part of
cp_not_expected_minutesintminas ac_not_expected_minutes, comparison (before the first readable day)
excluded_priceinthcalc.cost_buckets, like-for-like: the hour cells left out because an interval of either side has no price (K01, K02, K03); NULL for KNET and for every figure that is not a cost, and without a comparison
volume_effectnumberper rowcalc.cost_buckets, K01 only: Σ over the matched hour cells of (q_AC - q_CP) x P_CP x 0.001, P the price of the hour (§3.2); NULL where no cell is matched
price_effectnumberper rowcalc.cost_buckets, K01 only: Σ over the matched hour cells of (c_AC - c_CP) - the volume effect (§3.2)
unpriced_kwhnumberkWhcalc.cost_buckets: the energy of the period's intervals that have a price area and no price (KNET: of both series); coalesce 0 where there is energy; NULL for every figure that is not a cost
unpriced_hoursinthcalc.cost_buckets: the metering-point hours with an interval that has a quantity and a price area and no price (as pending_hours counts, P1 §9.3: two points with the same unpriced hour are 2)
unpriced_sharenumberfractionunpriced_kwh / the figure's energy (KNET: of both series), 9 decimals; NULL where there is no energy
strip_monthsjsonthe months of the period, YYYY-MM (every card, the coverage card included)
strip_delta_cp_pctjsonthe variance of each month as a fraction: E01 from the day summaries, G01 and G16 like-for-like
delta_matchednumberper rowE01 only: ac_matched - cp_matched, the consumption of the matched hour cells (calc.consumption_matched); NULL for G01, G16 (whose delta_cp is already like-for-like) and coverage, and where nothing is matched
delta_matched_pctnumberfractiondelta_matched / cp_matched, 9 decimals; NULL when cp_matched is not above zero
matched_reasontextthe query, E01: no_data (no cell with a quantity in the period), no_counterpart (every such cell lacks one: 29 February, the DST hours), missing_readings; NULL when cells are matched, without a comparison, and for the other rows
strip_delta_cpjsonCOVERAGE only (B15b): the variance of each month's coverage to the comparison as the difference of two shares (0.05 is 5 percentage points), like delta_cp of the COVERAGE row (calc.consumption_buckets by month); NULL elements where a month expects no minute
lowest_mp_idintCOVERAGE only (B15b): core.metering_point.mp_id of the E17 root with the most missing expected minutes in the period (calc.consumption_buckets per point; the smaller key on a tie); NULL when no root misses a minute
lowest_mp_missing_minutesintminCOVERAGE only: expected minutes of that root minus minutes with a quantity
lowest_mp_coveragenumbershareCOVERAGE only: that root's own coverage of the period, 9 decimals
expected_todatecalc.series_expected (B15b): the latest end of the expected ranges of the selected series (docs/queries.md, 'Which intervals are expected'); the pages say 'data til og med' and how much is not yet delivered where the period reaches past it
local_kwhnumberkWhG01 only, under a municipal method (municipality-method.md §5, B84): calc.emission_buckets' ac_local_kwh summed over the months, the energy that the municipality's own renewable production covered in the same hour (the exact sum of q x R x 0.01 over the intervals that have both inputs)
local_sharenumberfractionG01 only, under a municipal method (B84): local_kwh over the consumption of the intervals with both inputs (ac_factor_kwh), 9 decimals

overview.months (X1)

The measure of the chosen card by month. Reads: calc.consumption_buckets(), calc.emission_buckets(), calc.cost_buckets(). Personal columns: none. At most 400 rows.

ColumnTypeUnitSource: where the value comes from, and why it may leave
bucket_fromdatecalc.period_buckets: the first day of the month in the period
bucket_todatecalc.period_buckets: the last day of the month in the period
unittextfixed by the query (kWh, g CO2e, g CO2e/kWh, share)
polarityintfixed by the query: consumption, emissions and intensity -1, coverage +1 (notation manual §3); cost -1 (K01, KNET: a lower net cost is better), the price (K03) and the energy sold (K02) 0 (phase-2.md §3.2)
acnumberper rowts.day_load (E01, E03, ENET, coverage) or calc.emission_buckets (G01, G16): the period's own figure; E03 is that of the selected roots' export children (calc.consumption_buckets with p_export), ENET is E01 - E03 where both are
cpnumberper rowthe same for the comparison period (docs/queries.md, 'The comparison'): py the previous year, days by month and day and the last day of February to the last day of February; pp and from:<date> an earlier period of the period's length, days by the position of the month and the day of the month (whole months) or by offset; each comparison day counted in one bucket, the last day of a shorter month taking the later days of a longer one
cp_fromdatecalc.comparison_buckets: the first comparison day this row holds (a card: the comparison period's)
cp_todatecalc.comparison_buckets: the last comparison day this row holds, inclusive (a card: the comparison period's)
ac_matchednumberper rowcalc.emission_buckets, its like-for-like part: the matched hour cells only (E01 on overview.cards: calc.consumption_matched, the same cells without a factor)
cp_matchednumberper rowcalc.emission_buckets, like-for-like (E01 on overview.cards: calc.consumption_matched)
delta_cpnumberper rowac - cp (E01, E03, ENET, coverage); ac_matched - cp_matched (G01, G16)
delta_cp_pctnumberfractiondelta_cp / the comparison value, 9 decimals; NULL when the reference is not above zero
delta_cp_totalnumberper rowac - cp: the total variance, all days of both ranges (the comparison period whole, docs/queries.md 'The comparison'; the previous year with a 29 February in it included). E01, E03, ENET and coverage: equal to delta_cp (ENET's is the difference of the two total variances, named total). G01 and G16: differs from the like-for-like delta_cp when a cell has no counterpart
delta_cp_total_pctnumberfractiondelta_cp_total / cp, 9 decimals; NULL when cp is not above zero, and for coverage
ac_solid_amountnumberper rowtotal minus provisional
ac_provisional_amountnumberper rowE01: the estimated kWh (A03). G01: the emission of intervals whose reading is estimated or whose factor is not Final, counted once
ac_missing_minutesintminexpected minutes of the series-days minus minutes with a quantity (ts.day_load)
ac_incomplete_minutesintmints.day_load.minutes_incomplete (A05)
ac_pending_factor_minutesintmincalc.emission_buckets: stored quantity, price area known, no factor yet
cp_solid_amountnumberper rowas ac_solid_amount, comparison
cp_provisional_amountnumberper rowas ac_provisional_amount, comparison
cp_missing_minutesintminas ac_missing_minutes, comparison
cp_incomplete_minutesintminas ac_incomplete_minutes, comparison
cp_pending_factor_minutesintminas ac_pending_factor_minutes, comparison
provisionalboolprovisional amount x 100 > the figure: more than 1 % of it is provisional (notation manual §9, rule 2)
matched_hoursinthcalc.emission_buckets, like-for-like (h); E01 on overview.cards: calc.consumption_matched (h)
hours_in_periodinthcalc.emission_buckets, like-for-like (H); E01 on overview.cards: calc.consumption_matched (H)
excluded_readingsinthcalc.emission_buckets, like-for-like; E01 on overview.cards: calc.consumption_matched
excluded_factorinthcalc.emission_buckets, like-for-like; NULL for E01 (a consumption needs no factor)
reasontextthe query: no_data, no_price_area, no_factor (the figure is unavailable); missing_readings, no_factor, no_data, no_counterpart (the variance is not applicable; no_counterpart also for consumption, when the row holds no comparison day)
pending_hoursinthcalc.emission_buckets: hours with a quantity and no factor yet
pending_kwhnumberkWhcalc.emission_buckets
pending_sharenumberfractionpending_kwh / the period's consumption, 9 decimals
ac_not_expected_minutesintmincalc.consumption_buckets (B15b): minutes of the bucket's days that no selected series is expected to hold (before its first readable day, after its expected end), never counted as missing; stored + missing + not expected = the minutes of the bucket's days of every selected series
ac_not_yet_delivered_minutesintmincalc.consumption_buckets: the part of ac_not_expected_minutes that is days after a valid metering point's last stored day inside the daily run's window (not yet delivered)
ac_outside_range_minutesintminac_not_expected_minutes minus ac_not_yet_delivered_minutes, in SQL (B15bx-03): the minutes before the first readable day or after the point's data ended, which the not-yet-delivered ones are not part of
cp_not_expected_minutesintminas ac_not_expected_minutes, comparison (before the first readable day)
excluded_priceinthcalc.cost_buckets, like-for-like: the hour cells left out because an interval of either side has no price (K01, K02, K03); NULL for KNET and for every figure that is not a cost, and without a comparison
volume_effectnumberper rowcalc.cost_buckets, K01 only: Σ over the matched hour cells of (q_AC - q_CP) x P_CP x 0.001, P the price of the hour (§3.2); NULL where no cell is matched
price_effectnumberper rowcalc.cost_buckets, K01 only: Σ over the matched hour cells of (c_AC - c_CP) - the volume effect (§3.2)
unpriced_kwhnumberkWhcalc.cost_buckets: the energy of the period's intervals that have a price area and no price (KNET: of both series); coalesce 0 where there is energy; NULL for every figure that is not a cost
unpriced_hoursinthcalc.cost_buckets: the metering-point hours with an interval that has a quantity and a price area and no price (as pending_hours counts, P1 §9.3: two points with the same unpriced hour are 2)
unpriced_sharenumberfractionunpriced_kwh / the figure's energy (KNET: of both series), 9 decimals; NULL where there is no energy

overview.mp_variance (X1)

The E17 roots ranked by the variance of the chosen card's measure to the comparison. Reads: calc.consumption_buckets(), calc.consumption_matched(), calc.emission_buckets(), calc.cost_buckets(). Personal columns: none. At most 500 rows.

ColumnTypeUnitSource: where the value comes from, and why it may leave
rankintrow_number over the absolute like-for-like variance (delta_matched), then the absolute total variance (delta_cp), largest first, NULLs last
mp_idintcore.metering_point.mp_id of an E17 root
unittextfixed by the query: kWh (E01), g CO2e (G01), DKK (K01)
polarityintfixed by the query: -1 (lower is better for all three)
acnumberper rowthe root's figure in the period: E01 ts.day_load; G01 calc.emission_buckets (the intervals with a factor); K01 calc.cost_buckets (the intervals with a price)
cpnumberper rowthe same for the comparison period (docs/queries.md, 'The comparison')
cp_fromdatecalc.comparison_buckets: the first day of the comparison period; NULL with cmp=none
cp_todatecalc.comparison_buckets: the last day of the comparison period, inclusive; NULL with cmp=none
delta_cpnumberper rowac - cp, all days (the card's delta_cp_total for G01 and K01)
delta_cp_pctnumberfractiondelta_cp / cp, 9 decimals; NULL when cp is not above zero
ac_solid_amountnumberper rowac minus its estimated part (E01 kWh, G01 the provisional CO2e, K01 the cost of estimated readings)
ac_provisional_amountnumberper rowthe estimated part of ac
ac_missing_minutesintminthe root's consumption: expected minutes minus minutes with a quantity (every measure)
ac_incomplete_minutesintmints.day_load.minutes_incomplete
cp_solid_amountnumberper rowcp minus its estimated part
cp_provisional_amountnumberper rowthe estimated part of cp
cp_missing_minutesintminas ac_missing_minutes, comparison
cp_incomplete_minutesintminas ac_incomplete_minutes, comparison
provisionalboolmore than 1 % of ac is provisional
ac_matchednumberper rowthe root's figure in the matched hour cells of the period: E01 calc.consumption_matched (no factor needed); G01 calc.emission_buckets (a factor on both sides); K01 calc.cost_buckets (a price for every interval on both sides)
cp_matchednumberper rowthe corresponding cells of the comparison period
matched_hoursinththe matched hour cells (h) of the measure's function
hours_in_periodinththe hour cells with a quantity in the period (H)
excluded_readingsinththe cells left out for missing or incomplete readings
ac_not_expected_minutesintmincalc.consumption_buckets (B15b): minutes of the period not expected of the root's series
ac_not_yet_delivered_minutesintmincalc.consumption_buckets: the not-yet-delivered part of ac_not_expected_minutes
ac_outside_range_minutesintminac_not_expected_minutes minus ac_not_yet_delivered_minutes, in SQL (B15bx-03)
cp_not_expected_minutesintminas ac_not_expected_minutes, comparison
delta_matchednumberper rowac_matched - cp_matched: the like-for-like variance the ranking draws, names and ranks by (the card's like-for-like variance of the root)
delta_matched_pctnumberfractiondelta_matched / cp_matched, 9 decimals; NULL when cp_matched is not above zero
matched_reasontextwhy no cell is matched: no_data, no_counterpart (29 February, the DST hours), missing_readings, and no_factor (G01) or no_price (K01); NULL when cells are matched and without a comparison
excluded_factorinthG01: the cells left out for a missing factor on either side; NULL for E01 and K01
excluded_priceinthK01: the cells left out for a missing price on either side; NULL for E01 and G01
reasontextG01 calc.emission_reason, K01 calc.cost_reason: why a root with consumption has no figure (no_price_area, no_factor, no_price; under a municipal method no_municipality, municipality_not_loaded, no_local_share); NULL for E01, where the root has a figure, and where it has no consumption

overview.mp_positions (X1)

Where each E17 root of the selection lies, for the map. Reads: calc.select_roots(), calc.mp_positions(). Personal columns: none. At most 1000 rows.

ColumnTypeUnitSource: where the value comes from, and why it may leave
mp_idintcore.metering_point.mp_id of an E17 root
precisiontextcalc.mp_positions().precision_tag: exact (the owner's file or the demo's), postcode (the midpoint of its postcode), none
xintmcalc.mp_positions().x: EPSG:25832 easting in metres; NULL for none
yintmcalc.mp_positions().y: EPSG:25832 northing in metres; NULL for none
reasontextcalc.mp_positions().reason: protected, no_master_data, no_postcode; NULL when placed

development.series (A1)

The chosen measure by month or day with the comparison and the variance. Reads: calc.consumption_buckets(), calc.emission_buckets(), calc.cost_buckets(). Personal columns: none. At most 800 rows.

ColumnTypeUnitSource: where the value comes from, and why it may leave
bucket_fromdatecalc.period_buckets: the first day of the day or month in the period
bucket_todatecalc.period_buckets: the last day of the day or month in the period
unittextfixed by the query (kWh, g CO2e, g CO2e/kWh, share)
polarityintfixed by the query: consumption, emissions and intensity -1, coverage +1 (notation manual §3); cost -1 (K01, KNET: a lower net cost is better), the price (K03) and the energy sold (K02) 0 (phase-2.md §3.2)
acnumberper rowts.day_load (E01, E03, ENET, coverage) or calc.emission_buckets (G01, G16): the period's own figure; E03 is that of the selected roots' export children (calc.consumption_buckets with p_export), ENET is E01 - E03 where both are
cpnumberper rowthe same for the comparison period (docs/queries.md, 'The comparison'): py the previous year, days by month and day and the last day of February to the last day of February; pp and from:<date> an earlier period of the period's length, days by the position of the month and the day of the month (whole months) or by offset; each comparison day counted in one bucket, the last day of a shorter month taking the later days of a longer one
cp_fromdatecalc.comparison_buckets: the first comparison day this row holds (a card: the comparison period's)
cp_todatecalc.comparison_buckets: the last comparison day this row holds, inclusive (a card: the comparison period's)
ac_matchednumberper rowcalc.emission_buckets, its like-for-like part: the matched hour cells only (E01 on overview.cards: calc.consumption_matched, the same cells without a factor)
cp_matchednumberper rowcalc.emission_buckets, like-for-like (E01 on overview.cards: calc.consumption_matched)
delta_cpnumberper rowac - cp (E01, E03, ENET, coverage); ac_matched - cp_matched (G01, G16)
delta_cp_pctnumberfractiondelta_cp / the comparison value, 9 decimals; NULL when the reference is not above zero
delta_cp_totalnumberper rowac - cp: the total variance, all days of both ranges (the comparison period whole, docs/queries.md 'The comparison'; the previous year with a 29 February in it included). E01, E03, ENET and coverage: equal to delta_cp (ENET's is the difference of the two total variances, named total). G01 and G16: differs from the like-for-like delta_cp when a cell has no counterpart
delta_cp_total_pctnumberfractiondelta_cp_total / cp, 9 decimals; NULL when cp is not above zero, and for coverage
ac_solid_amountnumberper rowtotal minus provisional
ac_provisional_amountnumberper rowE01: the estimated kWh (A03). G01: the emission of intervals whose reading is estimated or whose factor is not Final, counted once
ac_missing_minutesintminexpected minutes of the series-days minus minutes with a quantity (ts.day_load)
ac_incomplete_minutesintmints.day_load.minutes_incomplete (A05)
ac_pending_factor_minutesintmincalc.emission_buckets: stored quantity, price area known, no factor yet
cp_solid_amountnumberper rowas ac_solid_amount, comparison
cp_provisional_amountnumberper rowas ac_provisional_amount, comparison
cp_missing_minutesintminas ac_missing_minutes, comparison
cp_incomplete_minutesintminas ac_incomplete_minutes, comparison
cp_pending_factor_minutesintminas ac_pending_factor_minutes, comparison
provisionalboolprovisional amount x 100 > the figure: more than 1 % of it is provisional (notation manual §9, rule 2)
matched_hoursinthcalc.emission_buckets, like-for-like (h); E01 on overview.cards: calc.consumption_matched (h)
hours_in_periodinthcalc.emission_buckets, like-for-like (H); E01 on overview.cards: calc.consumption_matched (H)
excluded_readingsinthcalc.emission_buckets, like-for-like; E01 on overview.cards: calc.consumption_matched
excluded_factorinthcalc.emission_buckets, like-for-like; NULL for E01 (a consumption needs no factor)
reasontextthe query: no_data, no_price_area, no_factor (the figure is unavailable); missing_readings, no_factor, no_data, no_counterpart (the variance is not applicable; no_counterpart also for consumption, when the row holds no comparison day)
pending_hoursinthcalc.emission_buckets: hours with a quantity and no factor yet
pending_kwhnumberkWhcalc.emission_buckets
pending_sharenumberfractionpending_kwh / the period's consumption, 9 decimals
ac_not_expected_minutesintmincalc.consumption_buckets (B15b): minutes of the bucket's days that no selected series is expected to hold (before its first readable day, after its expected end), never counted as missing; stored + missing + not expected = the minutes of the bucket's days of every selected series
ac_not_yet_delivered_minutesintmincalc.consumption_buckets: the part of ac_not_expected_minutes that is days after a valid metering point's last stored day inside the daily run's window (not yet delivered)
ac_outside_range_minutesintminac_not_expected_minutes minus ac_not_yet_delivered_minutes, in SQL (B15bx-03): the minutes before the first readable day or after the point's data ended, which the not-yet-delivered ones are not part of
cp_not_expected_minutesintminas ac_not_expected_minutes, comparison (before the first readable day)
excluded_priceinthcalc.cost_buckets, like-for-like: the hour cells left out because an interval of either side has no price (K01, K02, K03); NULL for KNET and for every figure that is not a cost, and without a comparison
volume_effectnumberper rowcalc.cost_buckets, K01 only: Σ over the matched hour cells of (q_AC - q_CP) x P_CP x 0.001, P the price of the hour (§3.2); NULL where no cell is matched
price_effectnumberper rowcalc.cost_buckets, K01 only: Σ over the matched hour cells of (c_AC - c_CP) - the volume effect (§3.2)
unpriced_kwhnumberkWhcalc.cost_buckets: the energy of the period's intervals that have a price area and no price (KNET: of both series); coalesce 0 where there is energy; NULL for every figure that is not a cost
unpriced_hoursinthcalc.cost_buckets: the metering-point hours with an interval that has a quantity and a price area and no price (as pending_hours counts, P1 §9.3: two points with the same unpriced hour are 2)
unpriced_sharenumberfractionunpriced_kwh / the figure's energy (KNET: of both series), 9 decimals; NULL where there is no energy

energy.split (A1)

Bought, sold and net from the grid, in energy and in cost, with the comparison. Reads: calc.consumption_buckets(), calc.consumption_matched(), calc.cost_buckets(), core.metering_point, ref.mp_type. Personal columns: none. At most 3 rows.

ColumnTypeUnitSource: where the value comes from, and why it may leave
figuretextfixed by the query: bought, sold, net, in that order (net last)
kwh_polarityintfixed by the query: bought -1 (consumption, notation manual §3), sold 0, net 0 (as ENET)
dkk_polarityintfixed by the query: bought -1 (a lower cost is better), sold 0, net -1 (as KNET, §3.2's table)
cp_fromdatecalc.consumption_buckets: the first day of the comparison period; NULL with cmp=none
cp_todatecalc.consumption_buckets: the last day of the comparison period, inclusive; NULL with cmp=none
kwh_acnumberkWhbought: calc.consumption_buckets over the roots' day summaries (the E01 card's figure); sold: the same over the export children's series (E03's); net: bought - sold where both are; NULL where there is none (never zero)
kwh_cpnumberkWhthe same for the comparison period (docs/queries.md, 'The comparison'); net: bought - sold where both are; NULL with cmp=none
kwh_ac_matchednumberkWhcalc.consumption_matched, like-for-like: the energy of the matched hour cells of the period, the cells eligible by P1 §9.3 on their readings alone (the E01 card's own; sold: the export children's, p_export); NULL for net and where no cell is matched
kwh_cp_matchednumberkWhcalc.consumption_matched, like-for-like: the same cells' energy in the comparison period; NULL for net
kwh_delta_cpnumberkWhkwh_ac_matched - kwh_cp_matched; NULL for net and where no cell is matched (i.r., with kwh_reason), never -100 %
kwh_delta_cp_pctnumberfractionkwh_delta_cp / kwh_cp_matched, 9 decimals; NULL when kwh_cp_matched is not above zero
kwh_delta_cp_totalnumberkWhkwh_ac - kwh_cp: all days of both ranges. Net: the difference of the two total variances (bought's minus sold's), named total
kwh_delta_cp_total_pctnumberfractionkwh_delta_cp_total / kwh_cp, 9 decimals; NULL when kwh_cp is not above zero
kwh_ac_provisionalnumberkWhcalc.consumption_buckets: the estimated kWh (A03) of the period; net: bought's minus sold's
kwh_provisionalboolthe provisional energy x 100 > the figure: more than 1 % of it is provisional (notation manual §9, rule 2); net: either part is
dkk_acnumberDKKcalc.cost_buckets: K01 (bought) or K02 (sold), the cost of the intervals that have a price at the day-ahead price of the point's price area, in DKK; net: bought - sold where both are (KNET); NULL where there is none, never zero
dkk_cpnumberDKKthe same for the comparison period; NULL with cmp=none
dkk_ac_matchednumberDKKcalc.cost_buckets, like-for-like: the cost of the matched hour cells of the period (eligible and priced for every interval, on both sides); NULL for net
dkk_cp_matchednumberDKKcalc.cost_buckets, like-for-like: the same cells in the comparison period; NULL for net
dkk_delta_cpnumberDKKdkk_ac_matched - dkk_cp_matched; NULL for net and where no cell is matched
dkk_delta_cp_pctnumberfractiondkk_delta_cp / dkk_cp_matched, 9 decimals; NULL when dkk_cp_matched is not above zero (manual §3)
dkk_delta_cp_totalnumberDKKdkk_ac - dkk_cp: all days of both ranges. Net: the difference of the two total variances, named total
dkk_delta_cp_total_pctnumberfractiondkk_delta_cp_total / dkk_cp, 9 decimals; NULL when dkk_cp is not above zero
dkk_ac_provisionalnumberDKKcalc.cost_buckets: the cost of the intervals whose reading is estimated (A03); a price has no version; net: bought's minus sold's
dkk_provisionalboolmore than 1 % of the cost, by absolute value, is provisional; net: either part is
kwh_matched_hoursinthcalc.consumption_matched, like-for-like (h): the energy's matched cells (the E01 card's matched_hours; sold: the export children's); NULL for net and with cmp=none
kwh_hours_in_periodinthcalc.consumption_matched, like-for-like (H): the hour cells with a quantity in the period; NULL for net
kwh_excluded_readingsinthcalc.consumption_matched, like-for-like: left out for a missing or incomplete reading; NULL for net
dkk_matched_hoursinthcalc.cost_buckets, like-for-like (h): the cost's matched cells, those of the energy that also have a price for every interval on both sides; NULL for net and with cmp=none
dkk_hours_in_periodinthcalc.cost_buckets, like-for-like (H): the hour cells with a quantity in the period; NULL for net
dkk_excluded_readingsinthcalc.cost_buckets, like-for-like: left out for a missing or incomplete reading; NULL for net
dkk_excluded_priceinthcalc.cost_buckets, like-for-like: left out because an interval of either side has no price; NULL for net
kwh_reasontextthe query, as the E01 card gives it: no_data (the figure is unavailable), missing_readings (the comparison has no figure), then the like-for-like variance's own reason (calc.consumption_matched: no_data, no_counterpart, missing_readings); net: no_data, no_counterpart, missing_readings
dkk_reasontextcalc.cost_reason (0257), the one rule of K01, K02 and KNET: no_data, no_price_area, no_price (the cost figure is unavailable), then for the comparison no_counterpart, missing_readings, no_price_area, no_price, then the like-for-like variance's own (calc.cost_buckets' reason); net: the same over both legs together, no reading on either first
ac_missing_minutesintmincalc.consumption_buckets: expected minutes of the series-days minus minutes with a quantity (the roots' series for bought, the export children's for sold, both added for net: NULL where neither expects any)
ac_incomplete_minutesintmincalc.consumption_buckets: incomplete minutes (A05), as ac_missing_minutes
ac_not_expected_minutesintmincalc.consumption_buckets: minutes that no series of the row is expected to hold, never counted as missing
ac_not_yet_delivered_minutesintmincalc.consumption_buckets: the part of ac_not_expected_minutes that is days the API may still deliver
ac_outside_range_minutesintminac_not_expected_minutes minus ac_not_yet_delivered_minutes, in SQL
cp_missing_minutesintminas ac_missing_minutes, comparison; NULL with cmp=none
cp_incomplete_minutesintminas ac_incomplete_minutes, comparison
cp_not_expected_minutesintminas ac_not_expected_minutes, comparison
unpriced_kwhnumberkWhcalc.cost_buckets: the energy of the period's intervals that have a price area and no price; net: both series' added; coalesce 0 where there is energy, NULL where there is none
unpriced_hoursinthcalc.cost_buckets: the metering-point hours with an interval that has a quantity and a price area and no price (two points with the same unpriced hour are 2); net: both series' added
unpriced_sharenumberfractionunpriced_kwh / the row's energy (net: of both series together), 9 decimals; NULL where there is no energy

consumption.weekday_hours (A1)

The mean of each weekday and hour of the local day (the heatmap), with its margins and the comparison. Reads: calc.weekday_hour_cells(). Personal columns: none. At most 199 rows.

ColumnTypeUnitSource: where the value comes from, and why it may leave
kindtextfixed by the query: cell (a weekday and a clock hour), weekday (a margin: the 24 hours of a weekday), hour (a margin: a clock hour over the 7 weekdays)
weekdayintdaythe local day's ISO weekday (Europe/Copenhagen), Monday 1 to Sunday 7, of the start of the hour (calc.weekday_hour_cells, migrations 0188, 0240); NULL on an hour margin
clock_hourinthcalc.hour_cell: the local clock hour 0-23 of the start of the hour; the repeated hour of the 25-hour day is clock hour 2 again, and the 23-hour day has none; NULL on a weekday margin
kwhnumberkWhB20's column, kept for its page until the page reads ac (B62): ac where the measure is in kWh (E01, E03), NULL for G01 (a column named kwh never holds g CO2e, B67f)
rootsintrootcalc.weekday_hour_cells: the selected E17 roots that contributed an eligible hour
roots_expectedintrootcalc.weekday_hour_cells: the selected E17 roots with any eligible hour in the period
root_hoursinthcalc.weekday_hour_cells: the eligible hours of the contributing roots, complete by the rule of phase-1.md §9.3 (60 minutes covered once, each with a quantity, none of quality A02 or A05; G01 also a factor for every interval; E03 every export child of the root that has a reading in the period)
root_hours_expectedinthcalc.weekday_hour_cells: roots_expected times the hours of that weekday and clock hour the period holds, from the local days (23, 24 or 25 hours): the repeated hour counts twice, the missing hour of the 23-hour day not at all
min_root_hoursinthcalc.weekday_hour_cells: the fewest eligible hours of a contributing root; 0 when none
date_fromdatethe period's first local day
date_todatethe period's last local day: the end of an explicit range cut at the frontier (phase-1.md §2), so that no cell counts an hour after it
data_daysintdcalc.weekday_hour_cells: the local days with at least one eligible hour of any root
unittextfixed by the query from measure: kWh (E01, E03), g CO2e (G01)
polarityintfixed by the query from measure: -1 (E01, G01), 0 (E03, as B54's E03)
acnumberper rowthe measure of the hour (E01 ts.reading.quantity of the roots' own series; E03 that of their export children's series, summed per root; G01 the CO2e of calc.emission_intervals): per root the sum of its eligible hours' amount over their number, summed over the roots that have an eligible hour there, 6 decimals; the hour of a quarter-hourly series is the sum of its quarters; NULL when no root has one (never zero)
cpnumberper rowcalc.weekday_hour_cells: the same figure over the comparison period's own days (calc.comparison_period of the period as it ends at the frontier, docs/queries.md 'The comparison'), by the same rule; NULL with cmp=none, and where no root has an eligible hour there
cp_rootsintrootcalc.weekday_hour_cells: the selected roots that contributed an eligible hour of the comparison; NULL with cmp=none
cp_roots_expectedintrootcalc.weekday_hour_cells: the selected roots with any eligible hour in the comparison period; NULL with cmp=none
cp_root_hoursinthcalc.weekday_hour_cells: the comparison's eligible hours of its contributing roots; NULL with cmp=none
cp_root_hours_expectedinthcalc.weekday_hour_cells: cp_roots_expected times the hours of that weekday and clock hour the comparison's own days hold (its repeated hour twice, its missing hour not at all); NULL with cmp=none
cp_min_root_hoursinthcalc.weekday_hour_cells: the fewest eligible hours of a contributing root of the comparison; 0 when none; NULL with cmp=none
cp_data_daysintdcalc.weekday_hour_cells: the comparison's local days with an eligible hour of any root; NULL with cmp=none
cp_fromdatecalc.comparison_period: the comparison's first day, of the period as it ends at the frontier; NULL with cmp=none
cp_todatecalc.comparison_period: the comparison's last day, inclusive; NULL with cmp=none
roots_matchedintrootcalc.weekday_hour_cells: the selected roots that have a mean of this cell or margin on both sides; NULL with cmp=none
ac_matchednumberper rowcalc.weekday_hour_cells: the sum of the period means of the roots_matched roots, 6 decimals; NULL when none
cp_matchednumberper rowcalc.weekday_hour_cells: the sum of the comparison means of the roots_matched roots, 6 decimals; NULL when none
delta_cpnumberper rowac_matched - cp_matched from the unrounded sums, 6 decimals: a difference of means per hour over the roots on both sides, never of matched cells and never a root's whole mean; NULL (i.r.) when roots_matched is 0 or there is no comparison
delta_cp_pctnumberfractiondelta_cp / cp_matched from the unrounded sums, 9 decimals; NULL when cp_matched is not above zero

mp.master (D1)

Current master data of one metering point and its versions. Reads: core.metering_point, core.mp_version, ref.code, ref.mp_type. Personal columns: alias, meter_number, address. At most 200 rows.

ColumnTypeUnitSource: where the value comes from, and why it may leave
observed_frominstantcore.mp_version.observed_from
observed_toinstantcore.mp_version.observed_to; NULL for the current version
is_currentboolobserved_to IS NULL
typetextcore.metering_point.type_code
type_name_datextref.mp_type.name_da (R1 §5.1): the Danish name of the type; NULL when the table does not know it
sub_typetextcore.mp_version.sub_type: a closed code list (R1 §5)
sub_type_name_datextref.code (list sub_type, R1 §5.8): the Danish name of the code; NULL when the code has none, is NULL or is not in the table, and then the page shows the code
physical_statustextcore.mp_version.physical_status: a code
physical_status_name_datextref.code (list physical_status, R1 §5.8): the Danish name of the code; NULL when the code has none, is NULL or is not in the table, and then the page shows the code
net_settlement_grouptextcore.mp_version.net_settlement_group: a code
net_settlement_group_name_datextref.code (list net_settlement_group, R1 §5.8): the Danish name of the code; NULL when the code has none, is NULL or is not in the table, and then the page shows the code
connection_typetextcore.mp_version.connection_type: a code
connection_type_name_datextref.code (list connection_type, R1 §5.8): the Danish name of the code; NULL when the code has none, is NULL or is not in the table, and then the page shows the code
disconnection_typetextcore.mp_version.disconnection_type: a code
disconnection_type_name_datextref.code (list disconnection_type, R1 §5.8): the Danish name of the code; NULL when the code has none, is NULL or is not in the table, and then the page shows the code
settlement_methodtextcore.mp_version.settlement_method: a code
settlement_method_name_datextref.code (list settlement_method, R1 §5.2): the Danish name of the code; NULL when the code has none, is NULL or is not in the table, and then the page shows the code
grid_areatextcore.mp_version.grid_area: the three-digit grid area code, a public code
supplier_startdatecore.mp_version.supplier_start: a date
consumer_startdatecore.mp_version.consumer_start: a date
capacity_kwnumberkWcore.mp_version.capacity_kw
reading_occurrencetextcore.mp_version.reading_occurrence: PT15M, PT1H, P1M
reading_occurrence_name_datextref.code (list meter_reading_occurrence, R1 §5.3): the Danish name of the code; NULL when the code has none, is NULL or is not in the table, and then the page shows the code
unittextcore.mp_version.unit: the energy unit
unit_name_datextref.code (list unit, R1 §5.7; migration 0181): the Danish name of the code; NULL when the code has none, is NULL or is not in the table, and then the page shows the code
producttextcore.mp_version.product: a code
product_name_datextref.code (list product, R1 §5.8): the Danish name of the code; NULL when the code has none, is NULL or is not in the table, and then the page shows the code
tax_reductionboolcore.mp_version.tax_reduction
aliastextcore.mp_version.alias: the name the owner gave the point, for the local user
meter_numbertextcore.mp_version.meter_number: the device's number, kept on purpose (B07), for the local user on this query only
addresstextthe postal address, on the CURRENT version only and only when it says protected_name IS FALSE AND protected_address IS FALSE (N4); NULL on every earlier version, whatever its own flags (B15v-04)
address_withheldbooltrue on every row without an address: an earlier version, or a current one that does not say protected_name IS FALSE AND protected_address IS FALSE

mp.tree (D1)

The tree of the metering point's root with each child's role. Reads: core.metering_point, core.mp_version, ref.mp_type. Personal columns: alias. At most 500 rows.

ColumnTypeUnitSource: where the value comes from, and why it may leave
mp_idintcore.metering_point.mp_id
parent_mp_idintcore.metering_point.parent_mp_id
is_rootboolmp_id = root_mp_id
typetextcore.metering_point.type_code
type_name_datextref.mp_type.name_da: the seeded type list
type_name_entextref.mp_type.name_en: the seeded type list
roleintref.mp_type.role: 1 consumption, 2 production, 3 export, 4 import from grid, 5 tax basis, 6 surplus, 9 other
in_energy_totalsboolref.mp_type.in_energy_totals
chartable_as_loadboolref.mp_type.chartable_as_load: false for D15 and D04 (L1)
reading_occurrencetextcore.mp_version.reading_occurrence of the current version
aliastextcore.mp_version.alias of the current version: the owner's name for the point, for the local user
statusintcore.metering_point.status: 1 active, 2 no longer listed, 3 no current access, 4 invalid ID

mp.series (D1)

One series of the tree by hour or quarter-hour with quality. Reads: calc.series_intervals(). Personal columns: none. At most 3000 rows.

ColumnTypeUnitSource: where the value comes from, and why it may leave
business_typetextts.series.business_type (A04 consumption, A01 production)
interval_startinstantts.reading.interval_start; for a gap the expected start
interval_endinstantinterval_start plus the row's resolution
local_datedatethe interval's local day (Europe/Copenhagen)
resolutionintmints.reading.resolution; for a gap the grain or the resolution of the series' day (ts.day_load.resolution, else its nearest day's), whichever is longer
kwhnumberkWhts.reading.quantity (the sum of the quarters of an hour); NULL for a gap or A02
qualitytextts.reading.quality as A01-A05; NULL for a gap
storedboolfalse for an expected interval nothing is stored for
expectedboolcalc.series_expected (B15b): the interval lies inside its series' expected range (docs/queries.md); always true for a stored interval
not_expected_reasontextcalc.interval_expected: before_readable (before the first day the API can serve), not_yet_delivered (after a valid point's last stored day, inside the daily window), ended (after the day a point that is no longer valid ended); NULL when expected
expected_fromdatecalc.series_expected: the first expected local day of the row's series
expected_todatecalc.series_expected: the last expected local day of the row's series

mp.emission_intervals (D1)

Per interval, how the emission was computed. Reads: calc.emission_series_intervals(). Personal columns: none. At most 3000 rows.

ColumnTypeUnitSource: where the value comes from, and why it may leave
business_typetextts.series.business_type
interval_startinstantts.reading.interval_start
interval_endinstantinterval_start plus the row's resolution
local_datedatethe interval's local day
resolutionintmints.reading.resolution
kwhnumberkWhts.reading.quantity
qualitytextts.reading.quality as A01-A05
storedboolfalse for a gap
expectedboolcalc.series_expected (B15b): the interval lies inside its series' expected range (docs/queries.md); always true for a stored interval
not_expected_reasontextcalc.interval_expected: before_readable (before the first day the API can serve), not_yet_delivered (after a valid point's last stored day, inside the daily window), ended (after the day a point that is no longer valid ended); NULL when expected
expected_fromdatecalc.series_expected: the first expected local day of the row's series
expected_todatecalc.series_expected: the last expected local day of the row's series
price_areatextcore.mp_geo: the area valid on the interval's local day; NULL: none
pendingboolno factor under the basis
factor_versiontextfx.factor_hour.version as Initial, Preliminary or Final; NULL when pending
factor_retrieved_atinstantfx.factor_hour.retrieved_at
factor_generatedboolthe factor row is generated (the frozen extract), never Energinet's
factor_co2e_g_per_kwhnumberg CO2e/kWhfx.factor_hour co2_g + ch4_mg x GWP_CH4 x 0.001 + n2o_mg x GWP_N2O x 0.001
co2_gnumbergcalc.v_emission_interval: kwh x factor
ch4_mgnumbermgcalc.v_emission_interval
n2o_mgnumbermgcalc.v_emission_interval
biogenic_co2_gnumbergcalc.v_emission_interval: memo, outside the scopes
co2e_gnumberg CO2ecalc.v_emission_interval: Scope 2 excluding losses
transmission_co2_gnumbergcalc.v_emission_interval: amount x (t_factor - 1)
transmission_ch4_mgnumbermgcalc.v_emission_interval
transmission_n2o_mgnumbermgcalc.v_emission_interval
transmission_biogenic_co2_gnumbergcalc.v_emission_interval
transmission_co2e_gnumberg CO2ecalc.v_emission_interval
distribution_co2_gnumbergcalc.v_emission_interval: amount x (d_factor - 1), additive
distribution_ch4_mgnumbermgcalc.v_emission_interval
distribution_n2o_mgnumbermgcalc.v_emission_interval
distribution_biogenic_co2_gnumbergcalc.v_emission_interval
distribution_co2e_gnumberg CO2ecalc.v_emission_interval
re_share_pctnumber%fx.re_coverage_hour (public data) through calc.v_emission_interval: the municipal share of the interval's hour as delivered, 0 to 100; municipal methods only (municipality-method.md §5, B84)
local_kwhnumberkWhcalc.v_emission_interval: q x R x 0.01, the part the municipality's own renewable production covered; municipal methods only
grid_kwhnumberkWhcalc.v_emission_interval: q - local_kwh, the part that has the transmission grid's factor; municipal methods only
pending_reasontextcalc.v_emission_interval: why the interval has no figure under a municipal method: no_price_area, no_municipality, municipality_not_loaded, no_local_share or no_factor

mp.cost_intervals (D1)

Per interval of one point, the price used and what it cost. Reads: calc.cost_intervals(), calc.cost_point_status(). Personal columns: none. At most 3000 rows.

ColumnTypeUnitSource: where the value comes from, and why it may leave
business_typetextts.series.business_type (A04 consumption, A01 production)
interval_startinstantts.reading.interval_start; for a gap the expected start
interval_endinstantinterval_start plus the row's resolution
local_datedatethe interval's local day (Europe/Copenhagen)
resolutionintmints.reading.resolution; for a gap the grain or the resolution of the series' day, whichever is longer (as mp.series)
kwhnumberkWhts.reading.quantity (the sum of the quarters of an hour); NULL for a gap or A02
qualitytextts.reading.quality as A01-A05; NULL for a gap
storedboolfalse for an expected interval nothing is stored for (mangler)
expectedboolcalc.series_expected (B15b): the interval lies inside its series' expected range; always true for a stored interval
not_expected_reasontextcalc.interval_expected: before_readable, not_yet_delivered, ended; NULL when expected
expected_fromdatecalc.series_expected: the first expected local day of the row's series
expected_todatecalc.series_expected: the last expected local day of the row's series
price_areatextcore.mp_geo: the price area valid on the interval's local day (calc.price_areas); NULL: none
dkk_per_mwhnumberDKK/MWhcalc.cost_intervals (calc.interval_prices): the day-ahead price of the row's interval in DKK per MWh as delivered. At the hour's grain the hour's own price P: its row before the seam, the mean of its four quarters from it, none with fewer; as stored, the interval's own. Negative prices are kept. NULL: no price (afventer pris), a gap's slot without a price row, or no price area
price_resolutionintmincalc.cost_intervals: the resolution of the price rows used: 60 (the hour's row) or 15 (a quarter's own, or the quarters an hourly interval takes the mean of); NULL without a price
price_rowsintrowcalc.cost_intervals: 1, or 4 for the mean of the four quarters of an hourly interval from the seam; NULL without a price
price_generatedboolcalc.cost_intervals: a price row used is generated (the frozen extract), never Energinet's; NULL without a price
price_pendingboolthe query: the interval is stored, has a quantity and a price area, and no price: 'afventer pris' (a gap is 'mangler'; an interval without a price area has a NULL price_area and is neither)
cost_dkknumberDKKcalc.cost_intervals: the SUM of the costs (kWh x DKK per MWh x 0.001) of the row's intervals that have a price and a quantity, each at its own price: an hour of four quarters can cost other than kWh x P; may be negative; NULL for a gap and where none has
unpriced_kwhnumberkWhcalc.cost_intervals: the energy of the row's intervals with a price area and no price

mp.changes (D1)

Changed readings and withdrawn days in a window. Reads: ts.reading_change, ts.series, ts.day_load. Personal columns: none. At most 1000 rows.

ColumnTypeUnitSource: where the value comes from, and why it may leave
kindtextchange (ts.reading_change) or withdrawn_day (ts.day_load)
changed_atinstantts.reading_change.changed_at, or ts.day_load.withdrawn_at
business_typetextts.series.business_type
interval_startinstantts.reading_change.interval_start; NULL for a withdrawn day
local_datedatethe interval's or the day's local date
old_presentboolts.reading_change.old_present
old_resolutionintmints.reading_change.old_resolution
old_kwhnumberkWhts.reading_change.old_quantity
old_qualitytextts.reading_change.old_quality as A01-A05
new_presentboolts.reading_change.new_present
new_resolutionintmints.reading_change.new_resolution
new_kwhnumberkWhts.reading_change.new_quantity
new_qualitytextts.reading_change.new_quality as A01-A05

mp.ingestion (D1)

What the ingestion knows about one metering point. Reads: core.metering_point, ingest.mp_state, ts.day_load, ts.series, ingest.chunk. Personal columns: none. At most 2000 rows.

ColumnTypeUnitSource: where the value comes from, and why it may leave
parttextfixed by the query: readable_from, awaiting_first_data, latest_day, current_access, daily, chunks_by_state, open_window, unconfirmed_day, observed_absent
date_fromdateingest.mp_state.readable_from; ts.day_load.local_date; ingest.chunk.date_from
date_todateingest.chunk.date_to (half-open)
labeltextthe name of an ingest.chunk.state
countintingest.mp_state.daily_failures; the chunks of a state; ingest.chunk.attempts
codeinta documented DataHub error code: ingest.mp_state.last_daily_code, ingest.chunk.last_error_code
reasontextfixed by the query: verification_failed or not_delivered (§4.3)
atinstantingest.mp_state.last_daily_ok_at; ingest.chunk.next_try_at; ts.day_load.absent_since
flagboolawaiting first data (§6.3); current_access

mix.structure (A4)

The sources of the consumption for a period, by group or by connected area. Reads: calc.mix_buckets(), ref.mix_group, ref.code. Personal columns: none. At most 60 rows.

ColumnTypeUnitSource: where the value comes from, and why it may leave
parttextcalc.mix_buckets: the group code of ref.mix_group (by=source) or the connected area's code (by=origin: the code as delivered, never its name)
nametextref.mix_group.name_da (by=source) or ref.code, list connected_area (by=origin); NULL for a connected area the table does not know
knownboolcalc.mix_buckets: ref.mix_group / ref.code knows the part (a group always; an area not in ref.code is reported by make status)
ac_kwhnumberkWhcalc.mix_buckets: the part's energy over the hours whose mix is complete under the basis (§3.3 steps 2 and 6; the groups of an hour sum to its consumption exactly); NULL never zero where no hour is in the figures
ac_sharenumberfractioncalc.mix_buckets: ac_kwh / the consumption of the hours in the figures, 9 decimals
cp_kwhnumberkWhcalc.mix_buckets: the same over the comparison period's hours in the figures; NULL with cmp=none
cp_sharenumberfractioncalc.mix_buckets: the comparison's share of its own consumption of the hours in the figures; NULL with cmp=none
ac_matched_sharenumberfractioncalc.mix_buckets, like-for-like: the share over the matched hour cells of the period (the same cells on both sides)
cp_matched_sharenumberfractioncalc.mix_buckets, like-for-like: the share over the same cells of the comparison period
delta_cp_ppnumberppthe query: (ac_matched_share - cp_matched_share) x 100, exact, of the two matched shares the function returns; NULL where no cell is matched or the group has no share on either side
cp_fromdatecalc.mix_buckets: the first comparison day this row holds (the comparison period's)
cp_todatecalc.mix_buckets: the last comparison day, inclusive
matched_hoursinthcalc.mix_buckets, like-for-like (h), in metering-point hours
hours_in_periodinthcalc.mix_buckets, like-for-like (H)
excluded_readingsinthcalc.mix_buckets, like-for-like
excluded_mixinthcalc.mix_buckets, like-for-like: the cells whose hour has no complete mix under the basis on either side
reasontextcalc.mix_buckets: why the variance is not applicable (no_data, missing_readings, no_mix, no_counterpart); NULL when cells are matched and without a comparison
basis_kwhnumberkWhcalc.mix_buckets: the period's consumption, every hour (E01, as on the cards)
basis_mix_kwhnumberkWhcalc.mix_buckets: the consumption of the hours in the figures (the denominator of E11a and E11b); NULL when no hour is
basis_mix_hoursinthcalc.mix_buckets: the metering-point hours in the figures
basis_e07_kwhnumberkWhcalc.mix_buckets: E07, the renewable energy in the grid's mix (§3.3 step 4: Σ group energy x renewable_share)
basis_e11anumberfractioncalc.mix_buckets: E11a = E07 / the consumption of the complete hours, 9 decimals; NULL, never zero, with no complete hour
basis_e11bnumberfractioncalc.mix_buckets: E11b = (E07 + nuclear) / the same, 9 decimals
basis_cp_e11anumberfractioncalc.mix_buckets: E11a of the comparison period; NULL with cmp=none
basis_cp_e11bnumberfractioncalc.mix_buckets: E11b of the comparison period; NULL with cmp=none
basis_cp_e11a_matchednumberfractioncalc.mix_buckets, like-for-like (cmp_e11a): E11a of the comparison over the matched cells; NULL with cmp=none or where none is matched (M1f)
basis_ac_e11a_matchednumberfractioncalc.mix_buckets, like-for-like (e11a over the matched cells): E11a of the period over the matched cells; NULL with cmp=none or where none is matched (M1f2)
basis_delta_e11a_ppnumberppthe query: (E11a - the comparison's E11a) x 100 over the matched hour cells, exact
basis_delta_e11b_ppnumberppthe query: the same for E11b
basis_pending_kwhnumberkWhcalc.mix_buckets: the consumption of the hours with a price area that are outside the figures under the basis (no complete mix, or not Final under basis=final)
basis_pending_hoursinthcalc.mix_buckets: those hours in metering-point hours: two roots with the same pending hour are 2
basis_pending_sharenumberfractionthe query: basis_pending_kwh / basis_kwh, 9 decimals; NULL where there is no consumption
basis_provisional_sharenumberfractioncalc.mix_buckets: (ac_preliminary_kwh + ac_initial_kwh) / ac_mix_kwh, 9 decimals, the share of the period's consumption in the figures (the columns' base, not all the consumption) whose mix is not Final; 0 under basis=final; NULL with no complete hour (M4f)
basis_cp_provisional_sharenumberfractioncalc.mix_buckets: (cp_preliminary_kwh + cp_initial_kwh) / cp_mix_kwh, 9 decimals, from the comparison's own status energies; 0 under basis=final; NULL with cmp=none or no complete hour of the comparison (M4f)

mix.series (A4)

E11a and E11b by day or month with the energy of each group, the comparison and the variance. Reads: calc.mix_buckets(). Personal columns: none. At most 800 rows.

ColumnTypeUnitSource: where the value comes from, and why it may leave
bucket_fromdatecalc.mix_buckets: the first day of the day or month in the period
bucket_todatecalc.mix_buckets: the last day of the day or month in the period
ac_kwhnumberkWhcalc.mix_buckets: the bucket's consumption, every hour
ac_mix_kwhnumberkWhcalc.mix_buckets: the consumption of the bucket's hours in the figures under the basis
ac_e11anumberfractioncalc.mix_buckets: E11a of the bucket, 9 decimals; NULL, never zero, with no complete hour
ac_e11bnumberfractioncalc.mix_buckets: E11b of the bucket, 9 decimals
ac_pending_kwhnumberkWhcalc.mix_buckets: the bucket's consumption with a price area that is outside the figures under the basis
ac_pending_hoursinthcalc.mix_buckets: those hours, in metering-point hours
ac_provisional_sharenumberfractioncalc.mix_buckets: (ac_preliminary_kwh + ac_initial_kwh) / ac_mix_kwh, 9 decimals, the share of the bucket's consumption in the figures whose mix is not Final; 0 under basis=final (only Final hours are in the figures); NULL with no complete hour (M1)
cp_provisional_sharenumberfractioncalc.mix_buckets: (cp_preliminary_kwh + cp_initial_kwh) / cp_mix_kwh, 9 decimals, from the comparison's own status energies; 0 under basis=final; NULL with cmp=none or no complete hour of the comparison (M1f)
groupsjsoncalc.mix_buckets by source: [{group, kwh, share, cp_kwh_matched, cp_share_matched, cp_kwh_all, cp_share_all}] for the nine groups in the order of ref.mix_group.sort: part_ac_kwh, part_ac_share, part_cmp_kwh, part_cmp_share, part_cp_kwh, part_cp_share (M1f: the comparison the form draws is on the comparable hours, the matched cells, as the variance; its level over all its own hours in the figures is cp_*_all and drawn nowhere in the form); kwh and share NULL, never zero, where the bucket has no hour in the figures, the comparison's where those hours have none, and all four with cmp=none; the nine shares of each side sum to 1 within the rounding of each (9 decimals, half away from zero)
cp_kwhnumberkWhcalc.mix_buckets: the comparison's consumption for the bucket's comparison days; NULL with cmp=none
cp_mix_kwhnumberkWhcalc.mix_buckets: the comparison's consumption of the hours in the figures
cp_e11anumberfractioncalc.mix_buckets: E11a of the comparison days of the bucket
cp_e11bnumberfractioncalc.mix_buckets: E11b of the comparison days of the bucket
cp_fromdatecalc.mix_buckets: the first comparison day this row holds
cp_todatecalc.mix_buckets: the last comparison day this row holds, inclusive
ac_e11a_matchednumberfractioncalc.mix_buckets, like-for-like: E11a over the matched hour cells of the bucket
cp_e11a_matchednumberfractioncalc.mix_buckets, like-for-like: E11a over the same cells of the comparison
cp_kwh_matchednumberkWhcalc.mix_buckets, like-for-like (cmp_kwh): the comparison's consumption over the matched cells; NULL where none is matched (M1f)
ac_e11b_matchednumberfractioncalc.mix_buckets, like-for-like: E11b over the matched cells
cp_e11b_matchednumberfractioncalc.mix_buckets, like-for-like: E11b over the same cells of the comparison
delta_e11a_ppnumberppthe query: (ac_e11a_matched - cp_e11a_matched) x 100, exact; NULL where no cell is matched
delta_e11b_ppnumberppthe query: (ac_e11b_matched - cp_e11b_matched) x 100, exact
matched_hoursinthcalc.mix_buckets, like-for-like (h), in metering-point hours
hours_in_periodinthcalc.mix_buckets, like-for-like (H)
excluded_readingsinthcalc.mix_buckets, like-for-like
excluded_mixinthcalc.mix_buckets, like-for-like
reasontextthe query: no_data (nothing stored), no_price_area (every hour lacks one), no_mix (consumption and no hour in the figures) make the figures NULL; missing_readings, no_mix, no_counterpart say why a variance is not applicable

mix.profile (A4)

The sources by the 24 clock hours of the day, with the comparison and the variance. Reads: calc.mix_buckets(). Personal columns: none. At most 24 rows.

ColumnTypeUnitSource: where the value comes from, and why it may leave
clock_hourintcalc.mix_buckets by the grain hour (M4): the class's local clock hour 0 to 23, always 24 rows in that order
hour_countinthcalc.mix_buckets (clock_hour_count): the local hours of the period's days in the class; the 25-hour day's 02 counts two (02A, 02B), the 23-hour day's none
hour_repeatedintcalc.mix_buckets (clock_hour_repeated): the days of the period on which the class occurs twice (02A and 02B of the 25-hour day)
hour_absentintcalc.mix_buckets (clock_hour_absent): the days of the period on which the class does not occur (02 of the 23-hour day)
ac_kwhnumberkWhcalc.mix_buckets: the class's consumption, every hour
ac_mix_kwhnumberkWhcalc.mix_buckets: the consumption of the class's hours in the figures under the basis
ac_kwh_per_hournumberkWhthe query: ac_kwh / hour_count, rounded once to 9 decimals half away from zero; NULL with no hour in the class
ac_mix_kwh_per_hournumberkWhthe query: ac_mix_kwh / hour_count, 9 decimals, half away from zero; NULL with no complete hour
ac_e11anumberfractioncalc.mix_buckets: E11a of the class, 9 decimals; NULL, never zero, with no complete hour
ac_e11bnumberfractioncalc.mix_buckets: E11b of the class, 9 decimals
ac_pending_kwhnumberkWhcalc.mix_buckets: the class's consumption with a price area that is outside the figures under the basis
ac_pending_hoursinthcalc.mix_buckets: those hours, in metering-point hours
ac_provisional_sharenumberfractioncalc.mix_buckets: (ac_preliminary_kwh + ac_initial_kwh) / ac_mix_kwh, 9 decimals, the share of the class's consumption in the figures whose mix is not Final; 0 under basis=final (only Final hours are in the figures); NULL with no complete hour (M1)
cp_provisional_sharenumberfractioncalc.mix_buckets: (cp_preliminary_kwh + cp_initial_kwh) / cp_mix_kwh, 9 decimals, from the comparison's own status energies; 0 under basis=final; NULL with cmp=none or no complete hour of the comparison (M1f)
groupsjsoncalc.mix_buckets by source: [{group, kwh, share, kwh_per_hour, cp_kwh_matched, cp_share_matched, cp_kwh_all, cp_share_all}] for the nine groups in the order of ref.mix_group.sort: part_ac_kwh, part_ac_share, part_ac_kwh / hour_count (9 decimals, half away from zero: the band of the day profile in kWh pr. time), part_cmp_kwh, part_cmp_share, part_cp_kwh, part_cp_share (M1f: the comparison the form draws is on the comparable hours, the matched cells, as the variance; its level over all its own hours in the figures is cp_*_all and drawn nowhere in the form); kwh and share NULL, never zero, where the bucket has no hour in the figures, the comparison's where those hours have none, and all four with cmp=none; the nine shares of each side sum to 1 within the rounding of each (9 decimals, half away from zero)
cp_kwhnumberkWhcalc.mix_buckets: the comparison's consumption for the class's comparison days; NULL with cmp=none
cp_mix_kwhnumberkWhcalc.mix_buckets: the comparison's consumption of the hours in the figures
cp_e11anumberfractioncalc.mix_buckets: E11a of the comparison days of the class
cp_e11bnumberfractioncalc.mix_buckets: E11b of the comparison days of the class
cp_fromdatecalc.mix_buckets: the first comparison day this row holds
cp_todatecalc.mix_buckets: the last comparison day this row holds, inclusive
ac_e11a_matchednumberfractioncalc.mix_buckets, like-for-like: E11a over the matched hour cells of the class
cp_e11a_matchednumberfractioncalc.mix_buckets, like-for-like: E11a over the same cells of the comparison
cp_kwh_matchednumberkWhcalc.mix_buckets, like-for-like (cmp_kwh): the comparison's consumption over the matched cells; NULL where none is matched (M1f)
ac_e11b_matchednumberfractioncalc.mix_buckets, like-for-like: E11b over the matched cells
cp_e11b_matchednumberfractioncalc.mix_buckets, like-for-like: E11b over the same cells of the comparison
delta_e11a_ppnumberppthe query: (ac_e11a_matched - cp_e11a_matched) x 100, exact; NULL where no cell is matched
delta_e11b_ppnumberppthe query: (ac_e11b_matched - cp_e11b_matched) x 100, exact
matched_hoursinthcalc.mix_buckets, like-for-like (h), in metering-point hours
hours_in_periodinthcalc.mix_buckets, like-for-like (H)
excluded_readingsinthcalc.mix_buckets, like-for-like
excluded_mixinthcalc.mix_buckets, like-for-like
reasontextthe query: no_hour (the class has no hour in the period: 02 of a period of the 23-hour day alone), no_data (nothing stored), no_price_area (every hour lacks one), no_mix (consumption and no hour in the figures) make the figures NULL; missing_readings, no_mix, no_counterpart say why a variance is not applicable

mix.hours (A4)

The sources of every hour of a window of at most 31 days. Reads: calc.mix_buckets(), ref.mix_group, ref.code. Personal columns: none. At most 745 rows.

ColumnTypeUnitSource: where the value comes from, and why it may leave
hour_utcinstantcalc.mix_buckets by the grain utc_hour (M5a, hour_utc): the UTC instant the hour starts
local_datedatecalc.mix_buckets by the grain utc_hour (bucket_key): the hour's local day, Europe/Copenhagen
clock_hourintcalc.mix_buckets by the grain utc_hour (clock_hour): the hour's local clock hour 0 to 23
occurrenceintcalc.mix_buckets by the grain utc_hour (hour_occurrence): 2 for the second 02:00 of the 25-hour day (02B), 1 otherwise
ac_kwhnumberkWhcalc.mix_buckets: the hour's consumption, every metering point of the selection
ac_mix_kwhnumberkWhcalc.mix_buckets: the consumption of the hour in the figures under the basis (a price area and a complete mix, Final under basis=final)
ac_e11anumberfractioncalc.mix_buckets: E11a of the hour, 9 decimals; NULL, never zero, with no consumption in the figures
ac_e11bnumberfractioncalc.mix_buckets: E11b of the hour, 9 decimals
ac_pending_kwhnumberkWhcalc.mix_buckets: the hour's consumption with a price area that is outside the figures under the basis (its mix pending, or not Final under basis=final)
ac_no_price_area_kwhnumberkWhcalc.mix_buckets: the hour's consumption of points without a price area on its day
ac_provisional_sharenumberfractioncalc.mix_buckets: (ac_preliminary_kwh + ac_initial_kwh) / ac_mix_kwh, 9 decimals; 0 under basis=final; NULL with no consumption in the figures
partsjsoncalc.mix_buckets by the grain utc_hour: [{part, name, known, kwh, share}] in part_sort: by=source the nine groups of ref.mix_group (name ref.mix_group.name_da), by=origin every connected area with energy in the window, the largest of the window first (name ref.code's, NULL for an area the table does not know, which keeps its code); kwh and share (part_ac_kwh, part_ac_share) NULL, never zero, where the hour has no consumption in the figures, 0 for a part without energy in an hour that has some; the energies sum to ac_mix_kwh exactly, the shares to 1 within the rounding of each (9 decimals, half away from zero)
reasontextthe query: no_data (nothing stored in the hour), no_price_area (every kWh of the hour lacks a price area), no_mix (consumption and nothing in the figures: the mix pending, or not Final under basis=final); NULL when the hour has figures

report.footprint (validation)

The blocks of Eloverblik's climate report for a period and a method. Reads: calc.footprint(), calc.mix_buckets(). Personal columns: none. At most 60 rows.

ColumnTypeUnitSource: where the value comes from, and why it may leave
blocktextfixed by the query: consumption, emissions, distribution_loss, transmission_loss, biogenic, co2_intensity, ch4_intensity, n2o_intensity (the blocks of L2 that phase 1 computes), then under a municipal method local_energy (B84: the exact sum of the municipal part, kWh; the method's ninth block, with blocks=emissions only until B88), then renewable_share_ex_nuclear, renewable_share_with_nuclear, source:<group_code> (the nine groups) and origin:<connected_area> (B59: calc.mix_buckets)
unittextfixed by the query: the report's unit of the block (kWh, kg CO2e, kg CO2, g/kWh, mg/kWh; fraction for a renewable share; kWh for a source and an origin)
valuenumberper rowcalc.footprint: a total as its exact sum in g x 0.001 (kg) or in kWh, never rounded; an intensity as amount / per_kwh rounded to 9 decimals; a renewable share E11a or E11b (calc.mix_buckets, 9 decimals), the energy of a source or an origin in kWh
amountnumbercalc.footprint: the exact sum behind the figure, in amount_unit (Σ over the intervals that have a factor, consumption over every stored quantity; a renewable share: E07, or E07 + nuclear, in kWh)
amount_unittextfixed by the query: kWh, g CO2e, g CO2, g, mg
per_kwhnumberkWhcalc.footprint: the quantity of the intervals that have a factor under the basis (intensity rows); calc.mix_buckets: the consumption of the hours whose mix is complete under the basis (the two shares); no other row
completeboolthe query: every MP-hour of the period has its readings (covered_hours = expected_hours); an emission block also a factor for every hour with a quantity (no pending hour, no hour without a price area, under a municipal method none without a municipality or a share); a row of the sources also some hour in the figures, none pending, none without a price area (B59)
reasontextthe query: no_data, no_factor, no_price_area, missing_readings, pending_factor, zero_consumption; under a municipal method also no_municipality, municipality_not_loaded and pending_share (hours with a wanted municipality and no share, before pending_factor), and with no hour in the figures the cause that holds the largest share of the consumption (calc.emission_reason); for a row of the sources also no_mix and pending_mix (B59)
rootsintcalc.footprint: the E17 roots selected
expected_hoursinthcalc.footprint: roots x the hours of the period's local days (23, 24 or 25 a day)
covered_hoursinthcalc.footprint: MP-hours whose stored intervals cover exactly the hour, whatever their quality
factor_hoursinthcalc.footprint: MP-hours with a quantity whose intervals all have a factor under the basis; emission rows only
pending_hoursinthcalc.footprint: MP-hours with a quantity, a price area and no factor yet (emission rows); calc.mix_buckets: MP-hours with a price area and no complete mix under the basis (rows of the sources)
no_price_area_hoursinthcalc.footprint: MP-hours with a quantity and no price area on their local day; every row but consumption carries it (a row of the sources too, B59f)

The building blocks (migrations 0120, 0140)

calc.period_buckets (day, month or period buckets), calc.previous_year_last (the rule of "The previous year": the last previous-year day of a day), calc.comparison_period and calc.comparison_buckets (0225, B55: a comparison's days and shift, and the comparison days of each bucket, "The comparison"; calc.previous_year_buckets before), calc.emission_intervals (the emission view of one method, GWP set and basis: the queries never read calc.v_emission_interval, which has one row per interval × method × GWP set × basis and would count every interval eight times; a call without the three, or with an unknown one, gives no row), calc.consumption_buckets (consumption from the day summaries, with the comparison, per bucket), calc.emission_buckets (from ONE read of the emission rows of the period and its comparison: the totals, quality contributions and the comparison per bucket, B12a's comparison per bucket, and the period's basis block); each takes the comparison (p_cmp, p_cmp_date), calc.series_intervals and calc.emission_series_intervals (one row per expected interval); calc.footprint (0140, B12b: the report's totals and what they rest on). Executable by elo_api only. elo_api reads, and owns nothing.

The readings are found by the selection's series (0212, B77, ADR-004 §5). Each function that reads readings first computes v_series := calc.selection_series(mp_ids), the array of the selected E17 roots' own series (NULL for every root), and its scan of ts.reading has series_id = ANY (v_series) as a condition of its own: in the plan of the call (plan_cache_mode = force_custom_plan) the array is a constant, an index condition of every monthly partition on its key (series_id, interval_start) with that array's estimate, which a join to the series is not while the functions plan without nested loops (B15f). For every root the condition is left out, and every partition is read whole, sequentially and in parallel, as before. One place each reads the readings: calc.selection_readings(series, from, to) for the consumption functions (calc.consumption_matched, its period and its comparison; calc.weekday_hour_cells), and calc.emission_intervals(…, series) (a seventh argument, NULL by default) for the emission functions (calc.emission_buckets, calc.footprint, calc.emission_series_intervals, calc.emission_matched). calc.series_intervals (one point, all its series) is as it was: it plans with nested loops allowed and already reads each partition by its key. A small selection's cost is therefore its own rows, not the database's in the period; a selection of every root reads every partition as before.

An aggregate emission query (overview.cards, overview.months and development.series with G01) returns the period's factor status and matched hours in its own rows, in the columns basis_* after the catalogue's columns; the runner builds basis.factorStatus, basis.factorSource and basis.matched from the first row and never sends these columns. So a response reads the emission rows once (it read them four times, B15v-02). mp.emission_intervals reads its factor status from the provider providers/factor_status.sql. Without a comparison (cmp=none) the comparison period is not read at all, as the row budget does not count it (B15v-06).

Cost

Measured on the demo organisation of B12a's test (18 E17 roots, 14 with data, 444 812 readings 2024-01-01 to 2026-11-13, the frozen factor extract) in the PostgreSQL 18 of the Colima VM (4 vCPUs), autovacuum off, through HTTP, warm; seconds per request, B15f's figures (docs/build/B15-report.md has the table before and after):

RequestAnalysedNever analysed
overview.cards, 2025 with 2024, all roots2.3–2.42.3
overview.months G01, the same2.42.2
development.series G01 by day, the same2.3–2.42.3
overview.cards, one month / one root for a year0.3 / 0.30.3 / 0.3
mp.emission_intervals, a week / a month of one root0.15 / 0.180.1 / 0.13
meta.context, E01 queries, overview.mp_variance, mp.series≤ 0.03≤ 0.09

The functions that read emission rows over a range plan their statement with nested loops disabled, and every function that reads readings plans without JIT, so that the plan does not depend on statistics: right after a load, before the tables are analysed, the planner expected one row of everything and joined the readings to the factors by a nested loop (every emission query answered 503 after the 30 s timeout). The jobs that load (B08b, B11) should still run ANALYZE on ts.reading, ts.day_load, fx.factor_hour and core.mp_geo after a load.

Cost after B15b

Measured the same way (warm, through HTTP, the Colima VM, a demo organisation of 12 roots with data, 2024-01-01 to 2026-11-13, the frozen factor extract), seconds per request, the fastest of three after a first; "before" is the table above (B15f, 18 roots; a same-day calibration is the untouched development.series G01 by day, 1.95 s here against 2.3–2.4 there):

RequestBeforeAfter
overview.cards, 2025 with 2024, all roots2.3–2.43.0
overview.cards, the default page's ytd(as a year)3.0
overview.cards, the widest period, 2024-01-01 to 2026-11-13–7.4
overview.cards, one month / one root for a year0.3 / 0.30.28 / 0.39
overview.mp_variance, 2025 / ytd / the widest≤ 0.031.2 / 1.2 / 3.2
overview.months E01, overview.months G01, development.series G01 by day≤ 0.03 / 2.4 / 2.40.02 / 1.9 / 1.95
mp.emission_intervals, a week / a month of one root0.15 / 0.180.06 / 0.13
mp.series a month, mp.master, meta.context≤ 0.030.03, 0.00, 0.01

What got dearer is what the like-for-like consumption variance reads: the readings of both years (calc.consumption_matched), about 0.6 s of the cards' year and 1.2 s of the ranking's, which read the day summaries only before. The two requests of X1's default page run in parallel, so the page waits for the cards (3.0 s). The ranking now counts its reading rows against the row budget (readings: always: above its row budget, 2 000 000 or ELO_ROW_BUDGET when set, it answers too_large_for_grain, as the cards do at their own, B77). The expected range (calc.series_expected, one read of ts.day_load per series) costs nothing that shows.

Of the 2.3 s of a year of 18 roots, reading the 248 000 emission rows of both years through calc.v_emission_interval is about 1.3 s (half of it the view's price-area lookup per reading), grouping them by hour 0.3–0.4 s and the like-for-like comparison 0.5–0.6 s.

Cost after B57

Measured the same way (warm, through HTTP, the Colima VM, the demo organisation of 18 roots loaded from 2024-10-01 to 2026-11-13, analysed as the owner's stack is: the loader analyses what it loads), seconds per request, the median of five after a first; "before" is the code before B57 (B56's functions, no cost in the queries):

RequestBefore B57After
overview.cards, 1 November 2025 to 31 October 2026 with the previous year, all roots4.075.06
overview.cards, ytd3.444.51
overview.months G01 / development.series G01 by day, the same year2.75 / 2.732.70 / 2.72
overview.months K01 / development.series K01 by day–1.21 / 1.19
overview.months KNET (two calls of calc.cost_buckets)–1.57
consumption.weekday_hours K01 / G01 / E01, the year, no comparison– / – / –0.85 / 1.02 / 0.36

The cards pay one call of calc.cost_buckets by month (1.2 s), as B56 measured it. **That is so only since migration 0256 and the runner's SET LOCAL jit = off**: B56 measured calc.cost_buckets on tables that were never analysed (1.1 s); once ANALYZE had run the same call took 3.03 s (the cards 7.06 s, K01 by month 3.13 s), and KNET's statement spent 2.4 s of its 4.1 s compiling. The first was an estimate: calc.window_hours made the hours of a day with a series whose bounds come from the calendar row, which the planner takes for 1 000 rows each, so that analysed (it then knew the 365 days of a year) it estimated the two windows' hours at 2 110 000 (never analysed 2 294 000) against 17 520, and the join of the readings' hours to them at 313 million rows analysed, which it hashed to disk in 4 096 batches (never analysed a hash of 64 batches: the same error, small in the one state). The series has constant bounds now (0 to 24, cut by the day's length): same rows, an estimate of 3 042 hours a year analysed and 433 never analysed against 8 760, and the largest hash of the call in 256 batches (0.05 s) in place of 4 096 (2.5 s) in either state (1.05–1.12 s analysed, 1.27–1.29 s never analysed, where the old text took 3.05 s and 1.21–1.24 s). The second: a statement of several CTEs over functions whose rows are guessed at 1 000 each is estimated above jit_above_cost, and PostgreSQL compiled it; the runner now sets jit = off for the request's transaction, as B77's functions do for their own statements. test_queries_b57.py holds both: the plan of the call in both states (batches, estimate, time) and a request that would be compiled if the runner did not say no.

Cost after B68

Measured the same way as "Cost after B57" (warm, through HTTP, the Colima VM, the demo organisation of 18 roots loaded from 2024-10-01 to 2026-11-13, analysed: 183 of 183 tables), the median of five after a first, the year 1 November 2025 to 31 October 2026 with the previous year:

RequestSeconds
energy.split, all roots, cmp=py / cmp=none3.13 / 0.72 (B68: 1.72 / 0.81, before the second scan)
energy.split, ytd, all roots, cmp=py2.78 (B68: 1.54)
energy.split, root 1 (with an export child), the year / October 2026, cmp=py0.74 / 0.10 (B68: 0.47 / 0.08)
overview.months KNET / K01 (beside), the same year1.52 / 1.16
mp.cost_intervals, 745 hours of October 2026, a root / an export child (read in quarters)0.08 / 0.09
mp.cost_intervals, 676 quarters of the week of 25 October, the export child0.05
mp.series / mp.emission_intervals, 745 hours of one root (beside)0.04 / 0.12

energy.split is two calls of calc.cost_buckets, two of calc.consumption_buckets (the day summaries, a few milliseconds) and, since B68f, two of calc.consumption_matched in one statement. With a comparison each reading row is read twice, so it takes about twice what KNET takes (3.1 s against 1.5 s for the year of the demo) and has half KNET's budget; B68 before the second scan measured 1.7 s. Without a comparison the second year is not read and calc.consumption_matched returns at once (0.7 s). Median of five after a first, the demo database analysed (183 of 183 tables).

Tests

services/api/tests/test_queries*.py: the catalogue and its refusals (no database), the acceptance criteria of B15's row, the queries of D1, the privacy rules, and the building blocks against the Python reference of B12a to the last decimal (test_queries_buckets.py). B84: test_queries_b84.py (every query that takes m under LB-MU-125, the reasons and their order, the cards' local_kwh and local_share, D1's columns, the footprint's ninth block and its 422, calc.emission_reason, calc.share_source's factorSource, the budgets and the times under both splits); test_queries_b66.py holds every price-area answer to the frozen fixture but for B84's members (_b84_part).

Kilde: docs/queries.md i løsningens repository.