Events Schema
Framedash stores raw telemetry in a ClickHouse events table. You can read it with SQL from three places:
- The REST
POST /v1/queryendpoint. - The
framedash queryCLI command. - The MCP
querytool.
This page lists the columns and the validator rules so you can write queries without the Claude Code plugin.
Access and scopes
Section titled “Access and scopes”Raw SQL requires an API key with the query:read scope (the Read-only + SQL preset); data:admin (the Full preset) also works, but keep data:admin keys for data export and erasure. A plain Read-only key can use the pre-built analytics endpoints and MCP tools but not the raw query path. An Ingest (events:write) key cannot query at all by design, and can learn only its own project ID and scopes via GET /v1/whoami.
Query rules
Section titled “Query rules”Queries are validated, rewritten to enforce project isolation, and run against a read-only connection. The validator enforces:
SELECTonly. NoINSERT,UPDATE,DELETE,DROP,ALTER,CREATE,TRUNCATE,SYSTEM,OPTIMIZE,KILL, orUNION/EXCEPT/INTERSECT.- Only two tables may appear in
FROM/JOIN:events(raw events) anddaily_sessions_project_mv(pre-aggregated daily sessions). Write plainFROM events; isolation filters are injected for you. - Do not reference
tenant_idorproject_idin your SQL. They are auto-scoped, and referencing them directly is rejected. - String literals use single quotes only. Double quotes and backticks are rejected.
- A
FROMwritten inside an expression is rejected with HTTP 400, and the error message always lists the same four function forms (the ones given below), whatever form the query used. This affects the SQL-standard spellingsextract(HOUR FROM timestamp),trim(BOTH ' ' FROM s),substring(s FROM 2 FOR 3),overlay(s PLACING r FROM n),substr(...)/mid(...)written with FROM, anda IS DISTINCT FROM b/a IS NOT DISTINCT FROM b(aFROMfollowed directly by a parenthesized subquery, such asextract(HOUR FROM (SELECT ...)), is accepted). The equivalent function forms aretoHour(timestamp)(likewisetoYear,toQuarter,toMonth,toISOWeek,toDayOfMonth,toMinute,toSecond),trimBoth(s)/trimLeft(s)/trimRight(s)(a second argument gives the characters to trim, e.g.trimBoth(s, 'x')),substring(s, 2, 3), andisDistinctFrom(a, b)/isNotDistinctFrom(a, b). - Subqueries used inside expressions —
IN (SELECT ...),NOT IN,= ANY (...),EXISTS (...)and scalar subqueries — can be nested at most six deep; a query that nests them deeper is rejected with HTTP 400. Subqueries inFROMandJOIN(derived tables) are not counted. Rewrite deepINchains asJOINs or derived tables. - A tenant can run up to three queries at the same time. A further query waits up to 10 seconds for one of them to finish. If none finishes, the request is rejected with HTTP 429 and a
Retry-Afterheader; retry after the indicated number of seconds. If the query service as a whole is at capacity, it returns HTTP 503, also withRetry-After. Both are separate from the endpoint’s request rate limit. - No
SETTINGS,FORMAT, orGLOBALclauses.IN (SELECT ...)andIN ('a','b')are allowed;IN some_tableis not. indexHint(...)is rejected with HTTP 400.$outside a string literal is rejected with HTTP 400 ($inside a string literal, such asevent_name = 'a$b', is fine).- The names
equals,and,identityand_CASTcannot be used as an alias name or as a lambda parameter name (for examplearrayMap((and, v) -> ..., ...)); a query that does so is rejected with HTTP 400. Calling them as functions (equals(a, b),identity(x)) and using AND as the operator are unaffected. - The request’s
limit(the default is 1000 on the REST endpoint) caps the number of rows a query returns. A query with its own top-levelLIMIT <number>, such asLIMIT 5000orLIMIT 10 OFFSET 5, keeps thatLIMITinstead, even when it is larger. Only when a query has no top-levelLIMIT <number>does anOFFSETorFETCHclause (for exampleORDER BY timestamp OFFSET 20 ROWS FETCH NEXT 10 ROWS ONLY), or aLIMITamount written as an expression such asLIMIT toUInt32(5), return the smaller of its own amount andlimit. A result of more than 10,000 rows is rejected with HTTP 400 in every case.
Read narrowing and limits
Section titled “Read narrowing and limits”Only a direct comparison of timestamp or event_name with a constant, written in the WHERE of the SELECT that reads events directly (FROM events), and joined to the other conditions with AND, narrows what a query reads.
Accepted forms:
timestamp <op> C,C <op> timestamp,timestamp BETWEEN C AND C, where<op>is=,<,<=,>,>=- The same with
toDate,toStartOfDay,toStartOfHour,toStartOfMonth,toYYYYMMDD, ortoYYYYMMaroundtimestamp event_name = '...',event_name IN ('...', ...)Cis built only from string and number literals,now(),today(),yesterday(),INTERVAL n UNIT,+and-, andtoDate/toDateTime/toStartOfDay/toStartOfHour/toStartOfMonthof such a constant.- A time text must be
'YYYY-MM-DD', optionally followed by a space orTandhh:mm:ss, optionally with up to six fraction digits. The year must be 1900 or later ('1899-12-31'does not narrow). Examples that narrow:'2026-11-01','2026-11-01 00:00:00','2026-11-01T00:00:00.5'(a text with fractional seconds narrows only when compared with baretimestamp, not withtoStartOfDay(timestamp)ortoStartOfHour(timestamp)). A text with a time zone ('2026-11-01T00:00:00Z',+09:00), without seconds ('2026-11-01 00:00'), or naming a day that does not exist does not narrow. All times are UTC. - A number must be a whole number (no decimal point). Compared with
timestampit is Unix time in seconds, from 0 to 999,999,999,999:timestamp >= 1767225600narrows; a date and time written as one number such as20261101000000does not. WithtoYYYYMM(timestamp)it must be a six-digit number (202611), withtoYYYYMMDD(timestamp)an eight-digit number (20261101). - The two sides must be of matching kinds:
toDate(timestamp)andtoStartOfMonth(timestamp)compare with a date ('2026-11-01',today(),toDate(...)), not with a text that has a time of day and not with a number;toYYYYMM/toYYYYMMDDcompare only with numbers. - In
INTERVAL n UNIT, n is a whole number and UNIT is one of SECOND, MINUTE, HOUR, DAY, WEEK, MONTH, QUARTER, YEAR in the singular. A condition written with a plural unit (INTERVAL 7 DAYS) or a quoted interval (INTERVAL '7 days') does not narrow, but the other conditions of the same WHERE still do.
- A time text must be
A condition does not narrow the read when it is under OR, negated (NOT) or wrapped in parentheses, on a joined table, on an alias-qualified column (e.timestamp), inside any other function, in an outer query over a subquery, or in HAVING. Such a condition still filters the result.
Example:
SELECT map_id, count() AS deathsFROM eventsWHERE timestamp >= today() - 7 AND event_name = 'player_death' AND map_id != ''GROUP BY map_idHere, the first two conditions (timestamp and event_name) narrow what is read, while map_id != '' only filters rows after they are read.
Conditions on other columns (player_id, map_id, build_id, …) filter rows after they are read; they do not make a query cheaper. As a rough example of the scale, reading more than around 20 million rows of a range can hit the 2 GB read limit and fail, so always bound queries by time.
A JOIN runs in the order it is written, and the server does not reorder joined tables or swap the two sides. The side written on the right of JOIN is read first and kept in memory while the left side is read, so put the smaller, more tightly filtered side on the right (for example a subquery that already narrows by timestamp and event_name) and the large side on the left. A query with the large side on the right can fail on the per-query memory limit.
The timestamp and event_name conditions of a query narrow nothing at all when the query:
- contains a lambda anywhere (
->orlambda(...), for examplearrayExists(x -> ...)); - uses a grammar keyword as an alias name after AS (for example
count() AS all,AS limit,AS then), or uses SELECT, DISTINCT, BY or PARTITION as an alias name without AS; - contains a number written directly against a letter,
_or a trailing dot, such as1e6,0x1For5.(ordinary decimals such as59.5are fine); - has a subquery that begins with
WITH; - uses
CASE timestamp WHEN ...orCASE event_name WHEN ...(the formCASE WHEN <condition> THEN ...is fine inside parentheses or outside the WHERE, but not at the WHERE’s own level); - defines an alias named
timestamporevent_name(for exampleSELECT fps AS timestamp); - is so long or so deeply nested that the database refuses the larger statement the server creates to narrow the read, so the query runs without narrowing.
Nothing in a WHERE narrows the read when that WHERE contains:
- the word
FETCH; - an
INTERVALwhose amount is computed or in parentheses, such asINTERVAL 7 * 2 DAYorINTERVAL (7) DAY(writeINTERVAL 14 DAYinstead); - a
CASEexpression or the? :conditional operator written at theWHERE’s own level, outside parentheses (for exampleWHERE timestamp >= today() - 7 AND CASE WHEN fps > 30 THEN 1 ELSE 0 END = 1narrows nothing; the same expression inside parentheses does not stop narrowing).
In all these cases the results are the same; only the amount of data read differs, and with it the speed and whether the query hits the 2 GB read limit.
Results are { "rows": [ { "col": "value" } ], "rowCount": 123 }. The CLI and MCP tool return exactly this shape. Calling the REST endpoint directly gets the standard API envelope around it: { "success": true, "data": { "rows": [...], "rowCount": 123 } }. The MCP query tool caps results at 1000 rows; the REST endpoint and CLI cap at 10000. For larger extracts, page with LIMIT ... OFFSET ... or narrow the timestamp range.
Columns
Section titled “Columns”| Column | Type | Notes |
|---|---|---|
event_name | String | Event name, e.g. player_death, level_start, perf_heartbeat |
timestamp | DateTime64(6) | Event time (UTC) |
session_id | String | Play-session id |
player_id | String | Stable player/device id |
position_x, position_y, position_z | Float32 | World coordinates |
map_id | String | Map/level identifier |
fps | Float32 | Frames per second (perf events) |
frame_time_ms | Float32 | Frame time in ms (perf events) |
memory_used_bytes | Int64 | Memory in bytes (perf events) |
gpu_time_ms | Float32 | GPU time in ms (perf events) |
game_thread_ms | Float32 | Game-thread time in ms |
render_thread_ms | Float32 | Render-thread time in ms |
camera_yaw, camera_pitch | Nullable(Float32) | Camera orientation |
source | String | automated for the SDK’s own internal events (session_start, perf_heartbeat); player for your Track(...) calls. Not a CI indicator — see Conventions below |
build_id | String | Build identifier (perf-diff candidate) |
platform | String | e.g. windows, android |
engine_version | String | Engine/build version string |
attributes | Map(String, String) | Custom string attributes |
metrics | Map(String, Float64) | Custom numeric metrics |
Map columns use bracket access: attributes['ci.branch'], metrics['score'].
There is no server_timestamp column. Use timestamp for event time. Selecting an unknown column returns a query error, so check the names above first. A rejected query comes back as HTTP 400 with the ClickHouse diagnostic message (unknown column, table, or function; syntax errors; type mismatches; forbidden operations); only infrastructure failures return 500.
Conventions
Section titled “Conventions”- The automatic performance event is
perf_heartbeat. Filter perf queries withWHERE event_name = 'perf_heartbeat'; not every event carriesfps/frame_time_ms. source = 'automated'marks the SDK’s own internal events (session_start,perf_heartbeat) as opposed to yourTrack(...)calls — it is set on every session, CI or not, and does not identify CI runs by itself.- To isolate CI profiling data, filter on
build_idor theattributes['ci.*']tags (set byBeginAutomatedSession/BeginAutomatedSessionFromEnvironment), not onsource. - CI metadata rides in
attributes:attributes['ci.branch'],attributes['ci.commit'],attributes['ci.scenario'], alongside the first-classbuild_idcolumn. - Event names are free-form strings you choose in
Track(...). The official SDK samples usesnake_case(player_death,level_start); keep one convention across your title. - Always bound
timestampusing the direct comparison forms above so queries narrow what they read and stay well within the 2 GB read limit.
Examples
Section titled “Examples”Active players today:
SELECT uniqExact(player_id) AS dauFROM eventsWHERE timestamp >= today()Event volume by name over the last 7 days:
SELECT event_name, count() AS events, uniqExact(session_id) AS sessionsFROM eventsWHERE timestamp >= today() - 7GROUP BY event_nameORDER BY events DESCPerformance percentiles per build:
SELECT build_id, count() AS samples, round(quantile(0.50)(fps), 1) AS fps_p50, round(quantile(0.95)(frame_time_ms), 2) AS frametime_p95_msFROM eventsWHERE event_name = 'perf_heartbeat' AND timestamp >= today() - 14GROUP BY build_idORDER BY samples DESCNext Steps
Section titled “Next Steps”- API Overview: authentication and the query endpoint
- CLI Reference:
framedash query - Troubleshooting: confirm events arrived before you query