Every signal your AI stack produces, in one platform
Back to guides
Core workflow

Writing your first TQL query

Syntax basics, common aggregations, and how the same query resolves against both ClickHouse and Postgres.

8 min to complete
1

Pick a source

Start with `from traces`, `from logs`, or `from ai_spans` — TQL infers which underlying datastore to query.

2

Filter with where

Use `where duration > 500ms and time > now() - 24h` — TQL rewrites time and duration literals per-engine automatically.

3

Aggregate

Use `select p95(duration), error_rate(), sum(cost)` — these map to the correct merge functions on ClickHouse's materialized views.

4

Save it

Save any query as a dataset so it can be reused on a dashboard or pulled through the API.

Stop guessing.
Start monitoring with Trasys.