Available tables
runs— all task run data including status, timing, costs, and task output.metrics— metrics data for your runs including CPU, memory, and custom metrics.
Run metadata (key-value pairs set in your task via
metadata.set()) is not available in the
Query tables. Use runs.retrieve() or the dashboard to inspect metadata.runs table columns
metrics table columns
See Logging, tracing & metrics for the full list of automatically collected metrics and how to create custom metrics.
prettyFormat()
Use prettyFormat() to format metric values for display:
bytes, percent, duration, durationSeconds, quantity, costInDollars.
Using the Query dashboard
Navigate to the Query page in the dashboard to write and run queries. Features include:- AI-powered query generation — describe what you want in natural language
- Syntax highlighting — SQL syntax highlighting for readability
- Query history — access your previous queries
- Interactive help — built-in documentation for TRQL syntax and functions
- Export options — download results as JSON or CSV
Querying from the SDK
Usequery.execute() to run TRQL queries programmatically:
Type-safe queries
Use theQueryTable type for inferred result types:
Query options
CSV export
Querying from the REST API
Execute queries via HTTP POST to/api/v1/query:
TRQL syntax guide
Basic SELECT
AS:
Using
SELECT * only returns a subset of core columns for performance reasons. Specify the
columns you need explicitly.Filtering with WHERE
Grouping and aggregation
Sorting and limiting
Available functions
Aggregate functions
Date/time functions
String functions
Conditional functions
JSON functions
Theoutput, error, and metrics.attributes columns are already JSON. Use dot notation to access nested fields — no JSONExtract* needed:
Query scopes
Time ranges
1h, 6h, 12h, 1d, 4d, 7d, 30d, 90d, etc.
Example queries
Failed runs in the last 24 hours
Failed runs in the last 24 hours
1d in the dashboard or period: "1d" in the SDK.Task success rate by day
Task success rate by day
Top 10 most expensive runs
Top 10 most expensive runs
Average compute duration over time
Average compute duration over time
CPU utilization over time
CPU utilization over time
Memory usage by task (past 7 days)
Memory usage by task (past 7 days)
Runs by queue and machine
Runs by queue and machine
Best practices
- Use the built-in time filter — set
periodorfrom/torather than filteringtriggered_atin the query body. - Always add
LIMIT— reduce returned rows when you don’t need everything. - Prefer approximate aggregations for large datasets — use
uniq()instead ofuniqExact()for faster approximate counts.
Limits
Check the Trigger.dev dashboard for current quota details.