Query Runs
View the history of executed queries. Each query run records the SQL text, execution time, result reference, and status. Useful for auditing and debugging query performance.
List query runs
GET
/v1/query-runsList query runs for the database named by the required X-Database-Id header.
Query parameters
limitinteger— Maximum number of resultscursorstring— Pagination cursorstatusstring— Filter by status (comma-separated, e.g. status=running,failed)saved_query_idstring— Filter by saved query ID
Headers
X-Database-Idstring— required. Database to scope the query runs to (required)
Response 200 — List of query runs
countinteger— required. Min:0has_moreboolean— requiredlimitinteger— required. Min:0next_cursorstring,nullquery_runsQueryRunInfo[] — requiredbytes_scannedinteger,null— Bytes this query actually fetched from storage. Not a measure of how much data the query covered — it counts the reads that reached storage, so the same SQL over the same rows reports a different number depending on what was already cached.nullmeans the query touched no table at all (for example a constant expression likeSELECT 1).0means the query read a table but fetched nothing from storage. It is a normal, common answer, not an error or a missing measurement, and it does not mean the query did no work —rows_scannedshows the rows it went through. The usual cause is a warm cache: re-running a query whose data or file metadata is already held in memory reports far fewer bytes than the first run, frequently0, withrows_scannedunchanged. A query answered from table statistics alone (a row count, say) also reports0. Because of this,bytes_scannedis not a proxy for query cost or query volume.GET /v1/usagesums this field over a period, so that total is the storage read a workspace caused, not the work its queries did: repeating one query cheaply adds little or nothing to it.completed_atstring,nullcreated_atstring— requirederror_messagestring,nullexecution_time_msinteger,nullidstring— requiredresult_idstring,nullrow_countinteger,nullrows_scannedinteger,null— Total rows read from storage to run this query, before any filtering or aggregation. Distinct fromrow_count, which is how many rows the query returned.nullwhen the query reads no table data from storage.saved_query_idstring,nullsaved_query_versioninteger,nullserver_processing_msinteger,null— Total server-side processing time for this query (milliseconds). Measured from query start to result ready. Includes SQL execution, task spawning, and result preparation. Does not include network transit. Populated for all completed query runs (sync and async).snapshot_idstring— requiredsql_hashstring— requiredsql_textstring— requiredstatusstring— requiredtrace_idstring,nulluser_public_idstring,null— Who ran this query: the account id from the access token the request was made with. Use it to group a caller's query history. Requests made with a credential that identifies no account instead record an opaqueuser_-prefixed identifier, which is stable for that credential but cannot be resolved to an account.warning_messagestring,null
{
"count": 0,
"has_more": true,
"limit": 0,
"next_cursor": "string",
"query_runs": [
{
"bytes_scanned": 0,
"completed_at": "2026-01-01T00:00:00Z",
"created_at": "2026-01-01T00:00:00Z",
"error_message": "string",
"execution_time_ms": 0,
"id": "string",
"result_id": "string",
"row_count": 0,
"rows_scanned": 0,
"saved_query_id": "string",
"saved_query_version": 0,
"server_processing_ms": 0,
"snapshot_id": "string",
"sql_hash": "string",
"sql_text": "string",
"status": "string",
"trace_id": "string",
"user_public_id": "string",
"warning_message": "string"
}
]
}
Errors
| Status | Description |
|---|---|
400 | Missing or malformed X-Database-Id header |
404 | Database not found |
Get query run
GET
/v1/query-runs/{id}Get the status and details of a specific query run by ID, scoped to the database named by the required X-Database-Id header.
Path parameters
idstring— required. Query run ID
Headers
X-Database-Idstring— required. Database the query run belongs to (required)
Response 200 — Query run details
bytes_scannedinteger,null— Bytes this query actually fetched from storage. Not a measure of how much data the query covered — it counts the reads that reached storage, so the same SQL over the same rows reports a different number depending on what was already cached.nullmeans the query touched no table at all (for example a constant expression likeSELECT 1).0means the query read a table but fetched nothing from storage. It is a normal, common answer, not an error or a missing measurement, and it does not mean the query did no work —rows_scannedshows the rows it went through. The usual cause is a warm cache: re-running a query whose data or file metadata is already held in memory reports far fewer bytes than the first run, frequently0, withrows_scannedunchanged. A query answered from table statistics alone (a row count, say) also reports0. Because of this,bytes_scannedis not a proxy for query cost or query volume.GET /v1/usagesums this field over a period, so that total is the storage read a workspace caused, not the work its queries did: repeating one query cheaply adds little or nothing to it.completed_atstring,nullcreated_atstring— requirederror_messagestring,nullexecution_time_msinteger,nullidstring— requiredresult_idstring,nullrow_countinteger,nullrows_scannedinteger,null— Total rows read from storage to run this query, before any filtering or aggregation. Distinct fromrow_count, which is how many rows the query returned.nullwhen the query reads no table data from storage.saved_query_idstring,nullsaved_query_versioninteger,nullserver_processing_msinteger,null— Total server-side processing time for this query (milliseconds). Measured from query start to result ready. Includes SQL execution, task spawning, and result preparation. Does not include network transit. Populated for all completed query runs (sync and async).snapshot_idstring— requiredsql_hashstring— requiredsql_textstring— requiredstatusstring— requiredtrace_idstring,nulluser_public_idstring,null— Who ran this query: the account id from the access token the request was made with. Use it to group a caller's query history. Requests made with a credential that identifies no account instead record an opaqueuser_-prefixed identifier, which is stable for that credential but cannot be resolved to an account.warning_messagestring,null
{
"bytes_scanned": 0,
"completed_at": "2026-01-01T00:00:00Z",
"created_at": "2026-01-01T00:00:00Z",
"error_message": "string",
"execution_time_ms": 0,
"id": "string",
"result_id": "string",
"row_count": 0,
"rows_scanned": 0,
"saved_query_id": "string",
"saved_query_version": 0,
"server_processing_ms": 0,
"snapshot_id": "string",
"sql_hash": "string",
"sql_text": "string",
"status": "string",
"trace_id": "string",
"user_public_id": "string",
"warning_message": "string"
}
Errors
| Status | Description |
|---|---|
400 | Missing or malformed X-Database-Id header |
404 | Query run or database not found |