sql to GET /v1/workspaces/{workspaceId}/events. Queries use the selected project and your current permissions. The records table never exposes another organization’s records. Accepted records are queryable while archival delivery continues. Each query fixes a sequence boundary for every selected project so new arrivals and delivery retries do not change its totals.
The editor highlights SQL and suggests supported keywords, aggregates, record fields, and nested metadata fields observed during ingestion in the selected project. Press Ctrl+Space for suggestions, Enter to accept, or Escape to dismiss. Ctrl+Enter (⌘+Enter on Mac) runs the query. Tab moves focus out of the editor.
Yellow underlines mark metadata fields not found in the project’s ingestion catalog; they do not prevent execution. Red underlines mark invalid or unsupported SQL. Hover an underline for details.
The catalog records field names when an event is accepted, without scanning archives or storing metadata values. It remembers up to 4,096 paths per project, up to eight levels deep and 512 characters per encoded path. Arrays are recorded as fields, without indexing their elements. Older records are not backfilled, and fields outside the catalog remain queryable. Catalog names remain until the organization is deleted.
Recent records
SELECT * returns complete, verifiable records. Select individual fields for a compact result table:
Grouped activity
Financial totals
Store amounts as integer minor units, within JavaScript’s safe integer range. Group currencies separately:amount_minor event metadata. A total is only meaningful for the field and records you select; Lodger does not infer accounting treatment or currency conversion.
SUM and AVG return decimal strings to preserve precision. AVG rounds to 40 significant digits. COUNT returns a number. Missing fields behave as SQL NULL; aggregates ignore null values, except COUNT(*), which counts every matching record. An empty sum is null and an empty count is zero.
Supported SQL
- One
SELECTfromrecords. - Record fields:
id,workspace_id,project_id,action,sequence,receipt,occurred_at,accepted_at,lane,user_visible,actor,target,metadata,source,retention,storage_tier. - Nested fields such as
actor.id,metadata.currency, andmetadata ->> 'currency'. WHEREwith comparisons,AND,OR,NOT,IN,BETWEEN,LIKE,ILIKE, andIS NULL.COUNT,SUM,AVG,MIN,MAX; up to four grouping fields and four ordering fields.GROUP BYandORDER BYcan name a field, a column alias, or a position in the select list, such asGROUP BY 1 ORDER BY 2 DESC.- Column aliases and
LIMITfrom 1 to 1,000. The default is 100.
DISTINCT, HAVING, or OFFSET. LIKE uses % for any sequence and _ for one character; backslash escape syntax is not supported. Comparisons preserve JSON types rather than converting strings into numbers. Default ordering is descending sequence for record queries. Nulls sort before values in ascending order and after values in descending order.
Query lifecycle
Queries capture a fixed sequence boundary and retention snapshot. Later writes do not change the result. Records outside retention are excluded unless protected by an active legal hold at the snapshot. A running query returns HTTP202, a query ID, and nextCursor. Repeat the same request with that cursor until it returns 200. Keep the SQL, project, and page size unchanged. Ready pages contain events for SELECT *, or columns and rows for projections and aggregates. Follow nextCursor until it is null. Results expire after 24 hours.
Cancel with DELETE on the same URL and cursor. Changing project access requires a new query. A cursor is not a credential.
Work allowances
Both bytes scanned and records processed count toward the monthly query allowance. Either limit can stop a query. Ingestion allowances are separate. Queries never silently return partial totals after exceeding an allowance.
Scan accounting uses the compressed bytes and record counts of candidate files after file-level pruning. Pending records count at their uncompressed snapshot size. Selecting fewer columns reduces actual I/O, but does not reduce that reservation. Repeated queries and later pages that execute another scan consume another allowance. Failed execution consumes its reserved work; a budget rejection does not execute the scan.
Queries allow three concurrent jobs per organization, up to 10,000 groups, 16 selected columns, and 128 MiB of grouped result state. The native engine uses bounded memory with disk spill and a ten-minute deadline.
LIMIT bounds output, not the work needed for filtering, grouped totals, or sorting. Use date or sequence predicates and project scope to reduce eligible files. Select only the fields you need; projections avoid reading unrelated Parquet columns.
Evidence exports use the same scan allowances. Their record selection completes before the download is assembled. Full-record results and exports verify individual record hashes; projected and aggregate results do not claim per-record cryptographic verification.
Use Queries above the editor to save a query, reopen it, or copy a shareable query link.
sequence is local to a project. For a recent-record view across projects, use ORDER BY accepted_at DESC, project_id DESC, sequence DESC. This ordering is deterministic but does not establish causality between projects.
Identical aggregate or projected queries can reuse a completed result for up to one minute when the selected project heads and permissions are unchanged. Retention and storage-tier transitions limit reuse. New arrivals invalidate the cached snapshot; a cache hit does not charge another scan.