BI node (/bi)
A BI node is a third kind of skaidb node, next to a cluster member and
a witness. It mirrors the databases you report on and serves the
business-intelligence app at /bi, so dashboard queries never land on a
member. Every other node redirects /bi to it, which means you can hand
out https://<any node>/bi and change your mind later about which
machine runs the app.
A BI node serves skaidb Analytics: a home page and a search over everything you can open; a query workspace with a SQL and PromQL editor, a visual query builder, a spreadsheet-grade result grid, charts and pivots; dashboards with filters, drill-down and live refresh; a library of saved queries with folders and version history; a data catalog with lineage, freshness and usage; a semantic layer of models and metrics; scheduled queries and alerts; and a record of what was run.
Why a separate node
Analytical reads are the heaviest shape the engine runs: wide GROUP BY,
window functions and DISTINCT ON materialise the whole filtered set, and
a join pulls both sides to the coordinator. A long read holds the engine
lock, and the lock prefers writers, so one dashboard refresh can stall
every writer on the node that serves it. Putting that on a node of its own
turns a dashboard storm into a problem for a machine that serves nothing
else.
The mirror is a witness, so nothing about replication is new: the same pull loop, the same table selection, the same watermarks. What the BI node adds is an app and an address.
The three shapes
| Backend | [witness] enabled |
[bi] enabled |
Meaning |
|---|---|---|---|
standalone (cluster.seeds = []) |
true | true | a BI node — mirrors the cluster, serves /bi |
| standalone | false | true | BI over the node's own data (single-node deployments, dev) |
| cluster member | — | true | refused at start-up |
A member refuses because serving analytics there defeats the point. The error names the fix.
Configure one
A BI node is an ordinary install (deb, rpm or the Docker image) with two
sections added to /etc/skaidb/skaidb.toml:
[server]
read_only = true # required: the mirror must not diverge
[witness]
enabled = true
primary_sql_addrs = ["192.168.7.3:7000", "192.168.7.4:7000"]
primary_internode_addrs = ["192.168.7.3:7100", "192.168.7.4:7100"]
user = "bi_witness"
password = "..."
databases = ["sales", "ops"] # what the reports read — or ["*"]: every user
# database, new ones mirrored on the next cycle
witness_id = "bi1"
region = "eu"
[bi]
enabled = true
advertise_url = "https://bi.example.net:7443/bi"
The cluster's members should run the same release as the BI node, or a newer one: the app keeps its saved work on the cluster, and a BI node ahead of its members can meet a statement they do not take yet — roll the members first, as with any witness.
The role on the primary needs the ordinary witness grants, plus the four
on _bi, where the app keeps saved queries and drafts:
CREATE USER bi_witness PASSWORD '...';
GRANT SELECT ON witnesses TO bi_witness;
GRANT INSERT ON witnesses TO bi_witness;
GRANT UPDATE ON witnesses TO bi_witness; -- one privilege per statement
GRANT SELECT ON DATABASE _bi TO bi_witness;
GRANT INSERT ON DATABASE _bi TO bi_witness;
GRANT UPDATE ON DATABASE _bi TO bi_witness;
GRANT DELETE ON DATABASE _bi TO bi_witness;
No CREATE grant is needed, and that is deliberate: CREATE DATABASE
requires CREATE ON GLOBAL, which would let a read-only mirror create
tables anywhere in the cluster. Every primary creates _bi at start-up
instead, alongside the witness registry it already creates, so the BI node
only ever reads and writes rows in it.
Who may use it
Using the BI app is its own privilege:
GRANT BI ON * TO analyst;
It is deliberately not a side-effect of SELECT. A role that may read a
table through a driver is not automatically someone who should have an
analytics console, a saved-query library and a dashboard on a shared node
— those are separate decisions, so they are separate grants. What a role
can then read is unchanged: its own SELECT grants, table by table.
This privilege opens the door; it does not widen the room.
ADMIN ON * implies it, as it implies everything. A role without it gets
403 naming the exact statement that fixes it, and the app shows that
message rather than "sign-in failed" — the password was right, and sending
someone to reset it wastes an afternoon.
Accounts on the BI node
BI users are local accounts on the BI node. It is a standalone node
with its own [auth], so its users are its own; nothing about them is
replicated from the cluster, and a BI login is not a cluster login.
-- on the BI node, as its superuser
CREATE USER analyst PASSWORD '<generated>';
GRANT BI ON * TO analyst;
GRANT SELECT ON DATABASE onet TO analyst; -- what they may read
Kerberos works here too. A BI node accepts SPNEGO exactly as any REST endpoint does, so an analyst with a ticket signs in without a password:
-- on the BI node, as its superuser
CREATE USER "[email protected]" GSSAPI; -- quoted: a principal is not a bare identifier
GRANT BI ON * TO "[email protected]";
GRANT SELECT ON DATABASE onet TO "[email protected]";
The app asks the node whether Kerberos is available (/bi/api/meta reports
sso) and, if it is, probes once without a credential so the browser can
answer the Negotiate challenge. Signed in that way, the account menu shows the
principal, and Sign out means "do not sign me in that way again in this
tab" — clearing a header cannot end a Kerberos session, the browser simply
negotiates again.
Four preconditions, none of them code you write:
- the node runs the amd64 glibc package (Kerberos is compiled in there; the static musl build can never do SPNEGO),
auth.gssapi_enabled = truewith a readableauth.gssapi_keytab,- the keytab holds an
HTTP/<host>@REALMprincipal — browsers ask for the HTTP service name, notskaidb/<host>(see KERBEROS.md), - the browser trusts the host (Chrome
AuthServerAllowlist, Firefoxnetwork.negotiate-auth.trusted-uris), and that host is the onebi.advertise_urlpoints at.
Principals map to roles exactly — [email protected] is the role
[email protected], case and realm included. There is no auth_to_local
rewriting, so the CREATE USER has to match what the KDC issues.
Two things follow from local accounts, and both are load-bearing:
- Grant only what the reports need. The BI node mirrors whole
databases, and witness table selection is not access control — what the
node holds is what a
SELECT-on-database grant can read. This cuts both ways when choosing what to mirror: a database holding OAuth tokens or API keys puts those bytes on the BI node, where one broad grant exposes them. Mirror such a database by explicit table list (witness.tables), or not at all. - A departing analyst must be removed here too. There is no central
directory behind these accounts yet;
DROP USERon the BI node is what ends their access to it.
The node is server.read_only, which exempts the superuser — so CREATE
USER and GRANT work there as the superuser and nowhere else.
[bi] keys
| key | default | meaning |
|---|---|---|
enabled |
false |
serve /bi here and advertise this node. Live-mutable (config set bi.enabled …). |
advertise_url |
"" |
the absolute URL browsers reach this node's /bi at. Required when enabled. |
max_concurrent_queries |
4 |
statements at once; past it, 429 after a short queue. Live-mutable. |
max_result_rows |
100000 |
rows one response may carry; shown on Run, and a truncated result says so. Live-mutable. |
usage_days |
30 |
how far Insights looks back, and how long local run history is kept. Live-mutable. |
cache_entries |
200 |
answers the result cache holds; 0 turns it off. Live-mutable. |
cache_ttl_secs |
60 |
how long an answer over tables with no sync clock (a node on its own, local tables) is served. Live-mutable. |
scan_row_budget / scan_byte_budget |
0 |
per-statement ceilings; 0 = the node's own budgets. |
The result cache keeps an answer per role, database, statement and bound
values. It serves the answer only while two things hold: no mirrored table
the statement read has synced since, and nothing in the catalog has changed
since the statement ran — no grant given or taken, no role or user made or
dropped, no view replaced, no object made, altered, renamed or dropped. A
cached answer is not checked against the role's privileges again, so it is
this rule that makes a REVOKE end the answers computed before it.
A BI statement's time ceiling is the node's own
storage.statement_timeout_secs, not a [bi] key. On a dedicated BI node
that is the same thing — nothing else runs there — so a second knob would
only be a second place to look. (There was a bi.query_timeout_secs for
one day; it was never wired to anything, and a documented knob that does
nothing is worse than no knob.)
advertise_url cannot be derived. The REST gateway never learns its own
advertised name — its only other redirect rebuilds the URL from the
request's Host header — and a target that browsers must reach is not
something to guess. Point it at whatever your users actually type,
including a reverse proxy in front of the node.
Where saved work lives
Saved queries, editor drafts, dashboards and their tiles are kept in a _bi
database on the cluster, not on the BI node. They are the only thing
a BI node holds that nobody can regenerate, so they get what any cluster
table gets: replicated writes, point-in-time recovery, BACKUP CLUSTER,
anti-entropy. Lose the BI machine and deploy another: every saved query
is back on its first pull, and a second BI node in another region sees
the same ones.
The mechanics follow from that:
- The BI node stays
server.read_only. Metadata writes travel over the same SQL control connection the witness already holds to a primary, so the mirror can never diverge from what it mirrors. - Metadata reads go to the primary too, which buys read-your-writes: a query you just saved is in the list on the next request rather than after the next pull cycle.
_bidoes not appear inSHOW DATABASESfor a role withoutADMIN: it is server-owned bookkeeping, and an analyst has no use for its tables. This is tidiness, not a boundary — RBAC governs access to it either way, and an admin still sees it listed._biis created by the primaries, not by the BI node, and mirrored like any other database; that copy is the fallback. A cluster that does not have one yet costs the mirror nothing — the pull skips it and keeps going with the databases the operator actually asked for. When no primary answers, the app serves saved work from the mirror, says so, and refuses to save rather than writing where the next cycle would overwrite it.- Run history is the exception: it is telemetry, high-churn and worthless
after a rebuild, so it stays local to the BI node, in its own
_bi.runs. It records what ran, who ran it, how long it took and which tables it read; it is swept tobi.usage_days, and it is what Insights is computed from. It is written as the superuser, which is the one roleserver.read_onlyexempts — the same path node_stats and the driver registry take.
Three more things live in _bi beside them. Preferences — a
person's favourites, what they opened last, how they left the workspace —
are one small document per role, so they follow that person to another
browser. Versions keep what a saved query said before each edit (the
newest thirty), which is what makes an edit something that can be read
and undone. And a verified mark on a saved query or a dashboard
records that an admin vouches for it, with who and when; only an admin
can set it, which is the whole point — a tag anyone can write is not a
signal.
Visibility is per row. You always see your own; you see other people's
when they marked them shared, read-only; ADMIN ON * sees everything.
Drafts are never shared with anyone, admins included — an open editor tab
is a thought in progress, not a document.
Every saved query records the tables its statement reads, parsed when it is saved. That is the usage half of lineage, and it is what will answer "what breaks if I drop this column".
How /bi finds the node
A BI node writes roles and bi_url into its own row in the witnesses
registry on every heartbeat. That is the only place a primary can learn a
witness's HTTP address: the registry is pull-only by design, and nothing
else on a member knows one.
Every other node then answers /bi:
- A member reads the registry rows it already caches for
/status, so the redirect costs no query. - A witness uses the list its own pull cycle caches from the primary
(it has no local copy of
defaultto read). - A standalone primary reads its own registry, briefly cached. A negative answer is never cached, so a BI node you just deployed shows up as soon as it beats.
The response is 302 Found with the path and query preserved, so
https://member/bi/d/sales?range=7d lands on that dashboard on the BI
node: /bi/d/<slug> is a dashboard's shareable address, and opening a
board puts it in the URL bar. Slugs are not unique — two boards may share
a name — so a link resolves to the newest match, and a slug that no longer
exists says so rather than showing an empty board. It is a
302 rather than a permanent redirect because which node serves the app is
a current choice: a browser that cached a permanent one would keep going
to a decommissioned node.
Selection rules:
?bi=<witness_id>pins a node, so a shared link can name the one it was built against. A pinned node that has been quiet for a day falls through to whatever can actually answer — the row is evidence it was retired — while a pin naming a node the registry does not list at all gets the "no BI node" page rather than somebody else's dashboards, because substituting a different node on a name we know nothing about would be silent and wrong.?region=<name>prefers a BI node there; without it, the region of the node serving the request is preferred, so a browser that reached a London member is sent to the London BI node. A preference is not a filter: when that region has nothing live, the request is still answered from elsewhere.- A member states its region in its identity row rather than in config
— it has no
[witness]block — withUPDATE node_aliases SET region = 'eu-west' WHERE node_id = '<internode id>'. A witness, BI node or standalone uses[witness] region. - Otherwise the most recently seen node wins.
- A node that has not heartbeat for three beats — at least 5 minutes, and
longer if
witness.interval_secsis above 100 s — stops receiving traffic. - A node never redirects to itself, so a mistyped
advertise_urlpointing back at a non-BI node shows the "no BI node" page instead of bouncing.
When nothing is registered, /bi answers 200 with a page explaining
what a BI node is and the exact config to deploy one. API clients that ask
for JSON (Accept: application/json) get 404 {"error": "no bi node
deployed"} instead, which is a state they can branch on.
Using it
Open /bi on any node — you land on the BI node either way.
The app is a navigation rail and a page. The rail holds Home,
Explore, Dashboards and Library; Data and Models;
Alerts and Activity; and, at the bottom, search, the light/dark
switch and the account menu. It folds to icons and back, and on a phone it
becomes a bar along the bottom. Every page has an address
(#/dashboards/<id>, #/data/shop.orders?tab=lineage,
#/explore/q/<id>), so anything on screen can be bookmarked or sent to
someone.
Two themes, light and dark, each chosen rather than inverted from the other — the chart colours are stepped for the surface they sit on. The app follows the system setting until you pick one.
Home and search
Home is where a session starts: what you starred, what you opened last, the newest dashboards and saved queries, alerts that are firing, how old the mirror is when there is one, and one-click starts for a new query, a new dashboard, browsing the catalog and the visual builder.
Search (⌘/Ctrl+K, or /) is a command palette over everything you
may open: pages, dashboards, saved queries by name, tag or description,
tables, models, folders and alerts, plus actions — New query, New
dashboard, Toggle theme, Sign out. Every word typed has to match;
matches at the start of a name rank first. Type something that looks like
a statement and it offers to run it in Explore. With nothing typed it
shows your recents and favourites.
A star on a dashboard, a saved query or a table puts it in Favourites. Favourites and recents are kept with your account on the cluster, not in the browser.
Keyboard: ? lists the shortcuts; g then h, e, d, l, c or
a jumps to Home, Explore, Dashboards, Library, the Data catalog or
Alerts.
Explore
Explore is the working surface: a side panel, an editor, and the result beneath it. The splitters between them drag, and the app remembers where you left them.
- The side panel has three tabs. Data is the catalog you can read: a filter box, tag chips, your recent and starred tables, then databases and their tables; a table opens to its columns, and a click on a column puts its name at the caret. Clicking a table previews its first 100 rows in a tab named after it — previewing another reuses that tab, and a tab you have typed into is never overwritten. Saved lists saved queries by folder. History is what you ran lately, with how long it took and what it returned; a click opens it in a new tab. The panel folds away, and below 860px it is a drawer over the editor.
- Tabs are drafts. Every open tab is stored under your name in
_bi, so the statements you left unfinished are still there tomorrow, on another machine, or on a BI node rebuilt from scratch — with their language, their builder picks and their chart. A dot marks a tab whose text is not saved as a query; closing one that holds unsaved text asks first. Double-click a tab to rename it. - The editor highlights SQL and PromQL, numbers its lines, pairs
brackets and quotes, indents with Tab, toggles comments with ⌘/Ctrl+/
and formats a statement with ⌘/Ctrl+Shift+F (keywords upper-cased,
one clause per line — never touching a string, a comment or a
{{parameter}}). Its height drags. - Auto-complete offers tables, columns, functions and snippets as you
type, from the catalog you can read — the same filter the tree
uses, because a completion list that named a table you cannot select
from would answer "does this exist?" for anyone who can type. A
declared FOREIGN KEY becomes a
JOIN … ON …suggestion, so the join the schema already describes is one the editor writes for you; a join into a parent you may not read is not offered. Arrows move, Tab or Enter accepts, Escape dismisses. - Run carries the row cap (
bi.max_result_rows); a result that hits it says truncated rather than quietly clipping. ⌘/Ctrl+Enter runs the statement under the cursor, and with Shift the whole editor as a script — the statements run in order, the last result is shown, and a failure names which statement failed. The status line gives the row count and the time, says when an answer came from the cache, and — when a statement examined far more rows than it returned — says how many. On a mirror it also shows data as of: the last successful pull cycle, which is the age of everything this node holds. - PromQL is the second language in the editor, for the mirrored
time-series tables. Pick a table, a range and a step, and write an
expression:
rate(cpu[5m]),sum by (host) (mem_used_bytes). The result comes back as a timestamp column and one column per series, so it charts, exports and becomes a dashboard tile exactly like a SQL result. PromQL has noFROM, so the table you pick is the scope, and it is also what the query counts as reading: a metrics tile shows up in that table's lineage and Insights like any other query. - Builder is the third: picks instead of a statement (see The query builder).
- Save (⌘/Ctrl+S) turns the tab into a saved query: a name, a description, a folder, tags, whether it is shared, and the type of each parameter. The presentation is saved with it — table, chart or pivot, and every chart setting — so a saved query reopens as the picture its author left. Only reads can be saved, and one statement at a time; the refusal says so at save time rather than at run time, because a saved query is something a dashboard will run later when nobody is watching. Saving again is one keystroke. Someone else's shared query opens as a copy, so you cannot edit theirs by accident. The menu beside Save adds it to a dashboard, schedules it, shows its version history, copies its link or deletes it.
- Expand gives the result the whole pane; Escape brings the editor back.
- Writes are refused, with the reason. A BI node reads a mirror; changes go to the cluster.
The result grid
- It is a sheet. Click a cell and drag, or shift-click, to select a
block; the strip says what it adds up to —
4×3 selected · Σ 1,204 · x̄ 100 · min 3 · max 480— and ⌘/Ctrl+C copies just that block as tab-separated text. Arrow keys move the selection, shift-arrows extend it, Escape lets it go. A click on a long value or a JSON cell opens it whole, pretty-printed, with a copy button. - It holds what the statement returned, up to the row cap, and draws only the rows in view, so a hundred thousand rows scroll like a hundred. A row whose cell carries four kilobytes of JSON scrolls inside the grid; it does not push the page sideways.
- Find, filter, sort, total. A find box across every column, with the
count it leaves — "9 of 60 rows". Filters puts a box under each
column name: a substring, or a comparison like
>100,<=0,=north. Clicking a column sorts by it; shift-clicking adds a second key, and a third, each numbered in the header. Totals adds a footer: sum and average where a column is numeric, a range where it is time, distinct counts otherwise. All of it works on the rows in hand and none of it changes the statement, so what you filtered is always what you can see, copy and total. - Columns. Drag the rule at a column's right edge to resize it; double-click it to fit the widest value. Freeze keeps the first column in view while you scroll sideways. Columns hides and shows them. A column's menu sets its format — number, integer, compact, percent, currency, bytes, duration, decimals — and turns on data bars or a colour scale behind its values.
- Sheet mode adds column letters and a formula bar. A formula that
reads a RANGE is one answer about the whole result and is shown in the
bar —
=SUM(C1:C50),=ROUND(AVG(D1:D200),2). A formula that reads the row it is on becomes a COLUMN, filled down, and joins the grid as one: sortable, filterable, totalled, copied, and removable with the × on its header. Write=B*C,=ROUND(D/100,2),=IF(C>50,'high','low'),=[unit price] * [quantity]— a bare letter is that column of the current row,C7is row 7 of column C,A2:B9is a rectangle, and a name in brackets is a column whose name has spaces.
About 30 functions: SUM, AVG, MIN, MAX, COUNT, COUNTA, COUNTIF, SUMIF,
ROUND, FLOOR, CEIL, ABS, SQRT, POWER, MOD, INT, SIGN, IF, AND, OR, NOT,
LEN, LOWER, UPPER, TRIM, LEFT, RIGHT, MID, CONCAT, COALESCE, ISBLANK,
NUMBER and TEXT, with + - * / % ^ &, comparisons and and/or. The
formula language is parsed and evaluated by the app itself — never
eval, which the gateway's content-security policy refuses anyway, and
which is the last thing anyone should point at a typed-in expression.
Formulas work on the rows on screen; to compute over the whole table,
put the expression in the statement, where the engine can push it down.
- To narrow the QUERY rather than the view, double-click a cell: that
derives a statement on the server (see Drill down below).
Charts
Chart turns the current result into a picture, and Chart settings opens the panel that shapes it.
- Types: line, area, bar (grouped, stacked or stacked to 100%), row, bar-plus-line, scatter and bubble, box plot, histogram, heatmap, radar, pie, donut, treemap, funnel, waterfall, sankey, map, a single number with its change against the previous row and a sparkline, a progress bar, a gauge against a target, and a formatted table. The app picks a first chart from the shape of the result — a time column and a measure is a line, a label and a measure is a bar, many categories is a row chart — and you change it from there.
- Data: the X column, one or more measures, and Break out by — a dimension whose values become the series, so revenue by region is one measure and a breakout, not one column per region. Types that read an extra option show it and the others hide it: a size for a bubble, a target for a gauge, a slice limit for the types that fold a long tail into an explicit "Other", a bin count for a histogram.
- Display: stacking, smoothing, point markers, value labels, where the legend sits, sort order, a goal line, a trend line.
- Axes and format: axis titles, a fixed minimum and maximum, a log scale, and how numbers read — compact, percent, currency, bytes, duration, decimals, a prefix and a suffix.
- Hover shows the values under the pointer — every series at that point on a line or area chart, the mark's own on bars, slices and cells. Clicking a legend entry hides or shows its series.
- Colour follows the series, not its position: eight fixed hues in a fixed order, checked for colour-blind separation, and a ninth series folds into "Other" rather than getting a generated colour. Hiding one series does not repaint the rest.
- Two measures share one axis by default. Bar-plus-line can be given a second axis on purpose, for the case where the two really are on different scales.
- A time axis labels what it can fit and no more, and it recognises a timestamp stored as a plain epoch-millisecond integer as one. The labels are thinned against the MEASURED width of the axis font, the coarse unit is printed where it changes rather than on every tick — "Apr 23 2026" then "May 19", "Jun 1" — the resolution follows the span from seconds up to years, and the last tick is always drawn. Times are UTC, as in the grid.
- The map has no basemap: every external host is blocked by the app's content-security policy, so points are plotted on a graticule rather than over tiles fetched from somewhere else.
- The chart belongs to the tab, so switching tabs does not lose it, and it is saved with the query.
Pivot turns a grouped result into a crosstab: one dimension down the
side, optionally another across the top, a measure in the cells, with an
aggregation for when several rows land in one cell, row and column
totals, and optional shading. The engine has no PIVOT and needs none —
GROUP BY a, b already returns exactly these triples, so this is
presentation. It is careful about three things: an absent combination
renders as a gap, not a zero ("did not occur" and "summed to nothing"
are different facts), only the widest 40 column values are shown and the
rest are counted, not dropped silently, and a truncated result says
so loudly, because a partial answer reshaped into a grid looks
complete.
Drill down by clicking a bar, point or slice — or double-clicking a
cell in the grid: the rows behind that value appear, with the statement
that produced them shown above — a filtered result nobody can inspect
is a magic trick, not a tool. The statement is derived, not guessed:
the one that drew the chart is parsed, its grouped dimension is pinned to
the clicked value, and its aggregates are dropped. Grouping by an alias
resolves back to the expression it names, so a time_bucket chart
filters on the bucket and not on a column that does not exist. A result
with no GROUP BY has no dimension to pin and says so; the rows on
screen already are the rows. "Open in the editor" puts the derived
statement in a new tab.
Dashboards
Dashboards lists the boards you can open — as cards or rows, searched, sorted, and narrowed to yours, shared ones or favourites. New dashboard starts blank or from a table.
A board is tiles on a grid (see Tile layout), each a saved query drawn some way, or a block of text.
- Tiles reference queries, never copy them. Fixing a query fixes every tile that shows it. A tile's menu opens it full screen (with a chart/table switch), opens its query in Explore, refreshes it, and downloads its rows as CSV or its chart as PNG. A tile whose query you may not read says so rather than drawing an error.
- Text tiles hold headings, notes and links, written in a small Markdown subset — headings, bold, italic, code, lists, rules, links. The text is built into the page as elements, never as markup.
- Edit switches the board into arranging mode: drag, resize, Add chart (pick a saved query, choose and tune its chart against a live preview, name it), Add text, Add heading, and per tile: edit, duplicate, remove.
- Filters belong to the board. The bar is the union of the parameters its tiles declare, so one date range or one region drives every tile that takes it, and a tile that does not declare a parameter ignores it. A date parameter gets relative presets — last hour, 7 days, 30 days — or an exact time; a parameter with an option list is a dropdown. Changing a filter re-runs only the tiles that read it and writes the value into the address, so a link to the board carries the view. A board can store its current values as its default filters.
- Click to filter. Clicking a mark offers to set the board's filter of that column's name to the value clicked — the bar on the "west" region filters every tile to west — or to drill into the rows behind it.
- Refresh re-runs the tiles; auto-refresh does it every 30 seconds to 15 minutes, saved with the board, and pauses while the tab is in the background. Tiles sharing a statement run it once. Past the node's concurrency limit a tile says it is queued and retries, so a big board degrades visibly instead of failing.
- Share makes the board visible to everyone who can use the app, and
copies its link. A board's address is
/bi/d/<slug>, readable and stable across renames. - Full screen hides the app around the board for a wall display; Escape leaves it. Export PDF prints the board laid out for paper. Duplicate makes a private copy with the same tiles in the same places.
- Chart it, on a table's page, is one click from an object to a dashboard. The starter tile is built from what the object actually holds: a time-series table gets a PromQL sum over its series key; a table with a timestamp column (typed, or epoch milliseconds in a plain integer — a schema-less store has both) gets a count per hour; anything else gets a top-N group-by on its first repeating text column. The board says what it built from, and the tile is an ordinary saved query, so the person who knows the table fixes it in ten seconds.
Library
Library is every saved query you can see — yours, shared ones, and what sits in shared folders — with a folder tree beside it. Search covers names, descriptions, tags and the statements themselves; the list filters to yours, shared with you, favourites, or one language, and sorts by any column. Select several to move or delete them together.
Each query's menu opens it, adds it to a dashboard, schedules it, moves it, edits its details, duplicates it, copies its link and deletes it — and deleting names the dashboards and alerts that use it first.
Version history lists what a saved query said before each edit, who changed it and when, with the differences from the current statement marked line by line. Restore saves that version back — itself an edit, so it can be undone the same way. History is for the query's owner (and admins), even when the query is shared: sharing publishes what a query says now, and a statement is usually cleaned up — a literal turned into a parameter — before it is shared.
A verified badge marks a query or a dashboard an admin has vouched for. Only an admin can set it, and it vouches for the content: changing what a query runs, or adding, editing or removing a tile or the default filters of a board, takes the badge off until an admin verifies it again. A board also loses it when a query behind one of its tiles is edited or deleted — a tile holds no statement of its own, so that is the ordinary way a board's content changes. Renaming, tagging, sharing and rearranging leave it.
Data
Data is the catalog: every database and table you may read, with its kind, description, tags and primary key — searched, sorted, and filtered by database, kind and tag. On a mirror it also shows, per table, when it was last fully swept and how far through its data the pull has reached. Those are two different clocks. A table whose newest row is months old is not a stale mirror; it is a quiet table. The Mirror tab is the page to open when someone says a number looks stale: what this node mirrors, the pull interval, the last cycle, and any table the last pull could not fetch — a cycle does not stop at the first failure, so "the mirror pulled" and "the mirror is complete" are separate facts and the page shows both. A node that mirrors nothing says so instead of showing empty freshness columns.
A table's page answers "what is this, and who depends on it":
- Overview: a description and tags anyone who can read the object may
write (the engine has no DDL for a comment on a table, so this is an
overlay in
_bi, and the row records who wrote it; clearing it removes the row, so "never described" and "deliberately blanked" are not two states), with its size, row count, key and freshness, and its first rows. Tags become facets over the catalog: a chip per tag, and selecting more than one narrows, so a table has to carry all of them. The number on a chip is what clicking it would leave — it counts the intersection with the facets already on and respects the text filter, because a count that promised more than the click delivered would be the reason nobody trusted the next one. - Sample: twenty rows.
- Schema: what the rows carry, and a note anyone can write on each
field. skaidb is schema-less, so the list comes from a sample rather
than a declaration — and that is exactly why the note matters: it is
often the only place
source_typeis ever explained. What breaks? on a field lists the saved queries that read it, kept in four groups because they carry different certainty — naming it, selecting every column, reaching it through a view or rollup (which may not carry it through at all), and a bare column name with several tables in scope. The answer states its own blind spots every time, including when it finds nothing: it covers saved queries the asker can see, so ad-hoc statements, other people's private work and a read reached only through a subquery are all outside it.
The Indexes and Constraints lists describe the CLUSTER's schema: a
witness mirrors views, foreign keys and check constraints along with
the data. Secondary indexes are mirrored only where the operator asked
for it (witness.mirror_indexes), and the page says which half it can
speak for: with the catalog swept but index replay off, "no
constraints" is a real answer while the index list is explicitly not
one. Until a node has swept at all, neither is. An empty list and "this
node cannot see them" are otherwise the same picture and opposite
facts.
- Lineage: upstream is what feeds it (a view's base tables, a
rollup's source, the parents its foreign keys point at); downstream is
what reads it (views and rollups built on it, its child tables, the
models over it, and the saved queries and dashboards that use it).
Catalog edges cover views, rollups, foreign keys, indexes, streams,
partition children, and the mirror edge that records a table as pulled
from the cluster. They are exact. Usage edges come from the tables each
saved query was parsed to read, so an ad-hoc statement nobody saved is
not in the graph, and the page says so rather than implying the list is
complete. Graph draws the neighbourhood, one to four hops out —
catalog edges solid, usage edges dashed; drag to pan, scroll to zoom,
click a node to open it.
- Insights answers the question a catalog usually cannot: is this
object actually used, and by whom. Runs in the window, how many people,
typical and slowest time, the statements run most (named when they are
saved queries), and the tables queried alongside it — the join
partners, which is how you find out what a table is really used with.
Every panel states its scope, because the honest answer is narrow: this
is BI traffic on this node, over bi.usage_days (default 30). A
driver, a job or another cluster reading the table is invisible here,
so "no runs" never means "unused". Every statement in Most run
carries a Run button: a saved one opens as itself, with its
language and its parameters; an ad-hoc one opens in the editor and
runs. A PromQL evaluation is recorded against its scope table as a
stand-in SELECT, so it counts as usage but is not offered as a
statement to re-run — that text would scan the table rather than
evaluate the expression.
- Access lists the roles whose grants reach the object. It needs
ADMIN ON * to read, so a non-admin sees an explanation rather than a
half-list that would read as "nobody else can see this". An MQTT
client-id grant (CONNECT) reaches no table and is not listed.
- Freshness: the mirror's two clocks for this one table.
From the page: Query opens it in the editor, Build in the builder, Chart it makes a starter dashboard, Model it derives a model.
Activity
My history is what you ran through the app in the last
bi.usage_days, newest first — one row per statement, at its latest run,
with how many times it ran, its duration and row count or its error; a
click opens it in Explore again. A tile on a refreshing board runs under
its owner every few seconds, and listed run by run it would bury
everything typed by hand.
Usage summarises the traffic: runs, people, errors, the median and 95th-percentile time, runs per day, the statements run most, who runs them, the slowest and the most recent failures. An admin sees everyone's; anyone else sees their own, and the page says which it is showing — somebody's ad-hoc statement can carry a literal they would not show a colleague. Like Insights it is BI traffic on this node only. One request reads a bounded number of runs; on a node that records more than that in the window, the page covers a shorter one and says so.
Load control
bi.max_concurrent_queries (default 4) bounds concurrent statements.
Past it a request waits a second and then gets 429 with a retry hint,
so a dashboard storm degrades visibly instead of dragging every tile
down. bi.scan_row_budget replaces the node's storage.scan_row_budget
for BI statements in either direction — a BI node is a dedicated node,
and a wider row budget is the point of having one, paid in engine time on
its own mirror pulls — while bi.scan_byte_budget can only tighten the
node's byte ceiling, which is what keeps a wide scan from materializing
more than the node holds. A statement that exceeds one is refused by
name: the message says bi.scan_row_budget when the [bi] budget is
what bound it, so the knob to raise is the one in the error, and the
response carries the knob and the rows examined as data. The app turns
that into the remedy that fits: a time-series ts picked without a
bucket gets a one-click bucket, a builder query with no filter is offered
one, and the knob is named for an admin. Grouped statements over row
tables with count/sum/avg/min/max stream one row per group and are not
bounded by the row budget at all; the refusal is for raw gathers — an
unbucketed time column on a time-series table, a count(*) over one, or
a distinct count.
BI traffic is tagged via = bi, so SHOW QUERIES, the slow log and the
audit log separate it from driver traffic. KILL QUERY works on it.
Layout and the content-security policy
The layout is fluid: nothing scrolls sideways from a 360px phone to a 4K
monitor, and no control ends up off the edge. Below 860px Explore's side
panel is a drawer; below 760px the rail is a bottom bar, boards are one
column and rows grow to touch size. Sizes follow the browser's own
font-size preference, since the scale is written in rem.
The app is plain files compiled into the server binary: no bundler, no
CDN, nothing fetched from anywhere else. The gateway serves it under
default-src 'none'; script-src 'self'; style-src 'self', which shapes
how it is written. A style attribute is dropped by that policy, so
appearance is always a class and both themes are tokens in one sheet;
only computed geometry — where a tile sits, where a tooltip opens — is
set from script. Nothing is ever built as markup from data: a table
name, a cell or a text tile reaches the page as text.
The query builder
Builder is the third language in the editor. Instead of a statement
you pick: a source (a table in the current database, or a model), the
columns to group by, the measures to compute, filters, a
sort and a limit. The pane on the left lists what the source
offers — every column of a table, with numeric ones also offered as
sum and avg, and timestamps bucketable to a minute, an hour or a day;
a model's declared dimensions and metrics. The statement the picks
compile to appears in the editor beneath, read-only, and runs, charts,
exports, saves and becomes a tile like any other.
Nothing picked is ever syntax. The server builds the statement from the
picks as an AST: a column has to be an identifier, a filter value becomes
a literal, and the text is parsed back and checked against the picks
before it is returned. A filter value of x' OR 1=1 -- filters on that
string. A {{parameter}} is refused in a filter — the builder takes
values; the SQL tab takes parameters.
Types are detected, not only read. The palette shows what each
column is, judged from its values where the catalog says too little:
an integer in the epoch-millisecond range is epoch ms, an ISO date
stored as text is iso date, a number stored as text is number as
text. Picking such a column applies the conversion that makes it what
it is, so an epoch-millisecond column buckets and charts as time. A
time-series table is read from its fixed shape — series-key columns are
labels, ts is the time, every field is a measure — and ts arrives
bucketed by the hour.
Column type conversion. Every chip on a raw table carries a type
select: as is, number, integer, text, timestamp, bool. It compiles to
the engine's to_* conversion — sum(to_float(price)),
time_bucket(1h, to_timestamp(created_ms)), to_bool(active) = true
— applied before bucketing and before aggregation, and a filter value
is coerced to the same type so the comparison is the one you meant. A
model field carries its own type in its expression and takes no cast.
Time-series sources compile to the shape the engine serves from
partial aggregates without a scan: a bucketed ts, label dimensions,
and a count/sum/avg/min/max of a field. count(*) over a time-series
table reads every raw sample and is not offered; count a field.
A saved builder query stores its picks, not only their text. Reopening it restores the builder; Edit as SQL lets the picks go and keeps the statement, one way — a saved query edited as SQL is a SQL query from then on. The Saved panel and the Library mark built queries. A builder tab's draft carries its picks, so it comes back as a builder tab.
Models
A model is a named set of definitions over a base table and its
joins: dimensions (expressions to group by — lower(country) as
region) and metrics (expressions that aggregate — sum(total) -
sum(cost) as margin). A metric must aggregate and a dimension must not;
neither may read another table through a subquery, name a window, take a
parameter, or call a function that writes. The Models page lists
them; New model defines one; a table's object page offers Model it,
which derives a model from the table in one step — every column a
dimension, each numeric column summed and averaged, and a row count — for
someone to rename and prune.
A model is what gives a number one definition. revenue means the same
thing on every board built from the model, and changing the definition
changes every board: when a model or one of its fields is saved, every
saved query built on it is recompiled and stored again, so a tile that
reads the stored statement gets the new meaning without being touched. A
change that would break a dependent — a field renamed out from under a
query that picks it — is refused, naming the queries, and deleting a
field or a model something is built on is refused the same way. Breaking
a dashboard on somebody else's screen at its next refresh is what the
refusal exists to prevent.
Models are private to their author unless marked shared or filed in a shared folder. Listing is not a gate: a model over a table you cannot read is not shown, and a shared model is compiled as you — if you may not read its base table, you cannot run a query built on it. A model's page shows its definition, its fields, and what is built on it; the lineage of a table shows the models over it, and the graph draws a model as a hop between the table and the queries built on it, keeping the direct table-to-query edge that carries the columns column impact walks.
Operating it
\biinskaidbshprints where the app is served, per node, or says none is deployed./statuson a BI node reports it; on a member, each entry ofwitnesses[]carriesrolesandbi_url.- The web UI badges a BI node as
<cluster>.bi.<alias>, and its witness card carries the endpoint. - Switching
[bi] enabledoff retires the endpoint on the next heartbeat — within onewitness.interval_secs— with no admin step.
Checking a deployment
crates/skaidb-server/tests/bi_smoke.py drives the real app in headless
Chrome against a running BI node. It signs in through the form — first
with a wrong password, which has to come back as a message — walks every
page, runs a statement, draws the result as every chart type and as a
pivot, saves the query with its chart and reopens it by link, confirms
the open tab reached the cluster as a draft, builds a dashboard with
chart, table and text tiles and opens it from its /bi/d/<slug> address,
moves a tile, finds the query again through the command palette and the
Library, opens a table's page and each of its tabs, repeats the page walk
in the dark theme and at a phone's width, signs out and checks the page
goes quiet. Any uncaught error fails it. It removes what it makes.
python3 crates/skaidb-server/tests/bi_smoke.py https://bi.example.net:7443 alice hunter2
It exists because the failures that matter here are invisible to the Rust
suite. A style attribute dropped by the content-security policy leaves
an element on the page and unpainted; the smoke test reads the computed
colour of a chart mark instead of trusting that the element exists. By
default it charts the node's own node_stats, so it is safe to run
against a live node; pass a database and a statement of your own as the
fourth and fifth arguments.
crates/skaidb-server/tests/bi_responsive.py is the layout half: sixteen
viewports from a 360px phone to a 4K monitor, on every page plus Explore
with a result, the builder and an open dashboard. It fails on a page that
scrolls sideways, a control off the edge with nothing to scroll it back,
text under 11px, or a result area collapsed below a usable height.
crates/skaidb-server/tests/bi_storm.py is the load half, and it needs no
browser. It builds a dashboard of many tiles over a smaller set of saved
queries — so tiles share statements and the cache and the coalescing are
both exercised — gives the board a refresh cadence so the node's own
scheduler works it too, then drives concurrent viewers at
/bi/api/query the way an opening dashboard does.
python3 crates/skaidb-server/tests/bi_storm.py https://bi.example.net:7443 alice hunter2
It reports throughput, p50/p95/p99, what share of answers came from the
cache, and how many requests the admission gate turned away — a 429
share is the gate WORKING, so it is reported against a ceiling rather
than failed. What it does fail on is a 5xx, a statement whose row count
changes between runs, a cache hit rate of zero (the cache never worked),
or a p99 past the threshold you pass. Like the smoke test it targets
node_stats by default and removes everything it made, so it is safe
against a live node — though its own rows land in _bi.runs, so numbers
are comparable within a run rather than across many.
Parameters
A saved query can take parameters. Write {{name}} in the statement and
declare each one with a type — ts, text, number or list:
SELECT region, sum(total) FROM orders
WHERE ts BETWEEN {{from}} AND {{to}} AND region = {{region}}
GROUP BY region
The editor grows a filter chip per parameter as you type it, and the save
dialog asks for the types — the one moment somebody is there to answer. Until
then the type is read off the value in the box, so WHERE n > {{floor}}
with -1 typed compares numbers rather than binding '-1' as text and
quietly matching nothing. A saved query never guesses: it carries its own
declarations.
Values are bound, never pasted. Each placeholder becomes a ?, the
statement is parsed once, and the values are substituted into the parsed
statement as literals. A value can therefore never become syntax, whatever
anybody types into a filter box. A list is the one shape that changes
the statement rather than a literal — IN ({{ids}}) with three values
becomes IN (?, ?, ?) — and that expansion is driven by the count, never
by the strings.
A {{name}} inside quotes is refused rather than substituted: '{{x}}'
would bind nothing and match the literal text, which is precisely the
silent wrong answer the types exist to prevent.
A ts takes milliseconds or a relative expression — now, now-7d,
now+1h — resolved when the statement RUNS. That is what makes a saved
dashboard mean "the last seven days" rather than the seven days that
ended when it was saved.
Dropdowns. A declaration may name where its values come from: a static list, or a saved query returning one column. The chip becomes a dropdown over them. The options query runs as the viewer, so a dropdown can never show a value its reader may not select for themselves, and the chosen value is still bound — a dropdown is a convenience over the same binding, not a second path into the statement. A value that is not in the list is still accepted and still bound, because the list may have changed since the dashboard was saved.
On a dashboard the filters belong to the board: the bar is the union of what its tiles declare, so one time range drives every statement that takes one, and a tile that does not declare a parameter ignores it.
Tile layout
Tiles sit on a twelve-column grid — twelve divides by two, three and four, so halves, thirds and quarters all land on whole columns — with rows of a fixed height. In Edit mode a tile is dragged by its header and sized from its bottom-right corner; a ghost shows the cell it will land in. The tile menu carries the same moves for the keyboard: left, right, up, down, wider, narrower, taller, shorter.
The server owns the arrangement. Every drag and resize sends an intent, the whole board is renormalised, and the browser redraws from the answer — so a change that displaced three other tiles shows all four moving, and two people editing the same board cannot save half of each other's work. Normalisation never moves a tile upward: a gap left deliberately survives a save. Only the newest change is drawn, because two in flight at once return in whatever order the network chooses and the older answer describes a board that no longer exists.
Editing a tile — its title, its chart, the query behind it — keeps its place. A new tile flows into the first free slot unless it was dropped somewhere on purpose.
Below 1100px the board restates itself in six columns; below 760px it is a single column in board order, each tile at a height that suits what it shows, because a quarter-width tile on a phone is not a smaller version of the same chart. Printing lays the board out on the full twelve columns.
Folders
Saved queries can be filed in folders, nested a few levels deep, from the Library: drag a query onto a folder, use Move to folder… on one query or on a selection, and create, rename, share, move and delete folders from the tree beside the list. A shared folder shows its saved queries to the people it is shared with, read-only; drafts stay private to their author even inside one, because a half-written statement is not a publication.
Folders organise; grants authorize. Moving a query between folders changes nothing about who may RUN it — a folder confers only the ability to see that the query is there. Conflating the two would turn a file tree into an access-control system nobody can audit, so it is deliberately not one: the grants decide, as they do everywhere else.
Deleting a folder that still holds queries is refused rather than cascading, and a folder cannot be moved inside its own descendant — a tree with a loop hangs every reader that walks it.
The query profile
Profile runs the statement again under EXPLAIN ANALYZE and shows
where the work went: the plan as steps from the access path up to the
result, each with the rows behind it, and a line naming what to look at
and the likely fix — an index, a narrower filter, a partition key.
It is honest about what it measures. The engine reports statement totals, not per-operator timings, so each number says whose it is rather than implying a breakdown that does not exist. On a cluster a scattered query's time is the coordinator's share, and the profile says so where that applies — a profile presenting one member's time as the whole is a lie the reader cannot detect.
Profiling runs the statement, so it takes a SELECT, and it goes through
the same gate, budgets and RBAC as any other query: it costs what the
original cost, and must not have a cheaper way in.
Exports
The Download menu over a result offers the whole statement as CSV or JSON, the rows on screen as an Excel workbook, and — on a chart — the picture as PNG or SVG.
CSV writes a file a spreadsheet opens correctly: a UTF-8 byte-order
mark (without it Excel on Windows reads the file in the system codepage
and mangles every non-ASCII cell), CRLF records, RFC-4180 quoting, and a
leading =, +, - or @ neutralised so a cell cannot arrive as a
formula — numbers excepted, since -42 is a number. NULL and the empty
string are written differently, so a reader can still tell them apart.
JSON writes the same envelope the app already speaks.
The export runs the STATEMENT rather than serialising the grid, bounded by
bi.export_max_rows instead of bi.max_result_rows — the number that
suits a screen and the number that suits a file are not the same, and
tying them together makes a large export impossible rather than slow. It
goes through the same runner as a query, so the admission gate, the
budgets, the parameter binding and the RBAC are the ones a query already
faces. The response carries X-Skaidb-Rows and X-Skaidb-Truncated: a
silently short file is the failure that matters, and a filename is the
one thing people rename.
XLSX is written by the browser from the rows the grid is showing —
sorted, filtered, with any formula columns — as a real workbook: numbers
are numbers, timestamps are dates, the header row is bold and frozen.
Text is stored as text, so a cell that begins with = arrives as that
text and not as a formula. It holds what is on screen; for more rows than
the screen's cap, export the statement as CSV.
PNG and SVG save the chart as drawn, with its colours and labels written into the file so it reads the same outside the app.
Scheduled queries and alerts
A saved query can carry a schedule, and optionally an alert: a condition over its result and somewhere to send it.
[[bi.destinations]]
name = "ops"
kind = "webhook" # or "slack"
url = "https://hooks.example.net/…"
The URL lives in the node's config rather than in _bi, and that is the
point: _bi is mirrored and readable by every BI user, so a webhook URL
stored there would be a credential sitting on a node analysts read. An
alert names a destination; only the operator can see what is behind
the name. The app lists the names and never the URLs.
The Alerts page lists every schedule with its cadence and condition in words, its state — firing, ok, scheduled, never run, disabled — and when it last ran and runs next; a row opens to its send history. New alert (also Schedule / alert on any saved query) builds one: the query, a cadence — every N minutes or hours, daily or weekly at a time, or a cron expression — a timezone, a condition and a destination.
A cadence is EVERY 5m or CRON '0 8 * * *' with a timezone. Timezones
are fixed offsets — UTC or +HH:MM — not named zones: skaidb
embeds no timezone database, and a schedule that silently ran an hour off
twice a year would be worse than one that refuses the spelling. The
shortest cadence is 60 seconds.
A condition is one of three, deliberately narrow — anything richer, the query itself expresses better:
| condition | fires when |
|---|---|
no_rows |
the query returned nothing |
any_rows |
it returned anything (the query is the predicate) |
| a cell comparison | the first row's named column crosses a number |
A cell condition over a result with no such column, or no rows, does not fire: "the number I watch is missing" is a different fact from "it crossed a line", and firing on it would send somebody hunting for a breach that never happened.
Only a change of state is sent, firing and resolved alike — a recovery is news, and an alert whose result flaps would otherwise notify sixty times an hour. Every send is recorded with its outcome, including failures, because an alert that quietly stopped being delivered is worse than one that never fired and only the history tells them apart.
Each run happens on this node, as the schedule's owner, through the same admission gate and budgets as a person's query — so a scheduled query can never read more than the person who saved it. It bypasses the result cache: an alert evaluating a cached answer cannot see the transition it exists to catch.
Deploying alongside witnesses
A BI node rolls exactly like a witness: same package, same unit, same readiness probe. It is a witness, so everything in CLUSTER_WITNESSES.md about table selection, grace periods and tombstone retention applies unchanged — including that witness table selection is not access control: what the BI node mirrors is what its users can read.
Size it for the mirror, not for the cluster: storage.memory_target
should match the machine (cgroup-aware, so a container gets its own cap).