Query Database Measurements
Query database statement execution counts and time with gcQL, as tables or time series.
Use database measurements to analyze statement execution counts and execution time. These endpoints require a backend with database statement measurements enabled and collected data.
For collection prerequisites, permissions, and measurement semantics, see PostgreSQL Database Monitoring and ClickHouse Database Monitoring. Health metrics and collected query traces are separate outputs; neither confirms that statement measurements are available. Use Activity Traces to diagnose collection.
Endpoints
Search statement measurements
POST /api/dbm-measurements/search
Query a time series
POST /api/dbm-measurements/search-time-series
Authentication
Send an API key in Authorization: Bearer <YOUR_API_KEY> and select the backend with X-Backend-Id: <YOUR_BACKEND_ID>. Self-hosted deployments use their own API base URL.
Request Body
start, end
string
Time range in RFC3339 format.
query
string
Required gcQL query. This endpoint accepts gcQL, not a raw pipeline object.
sources
array
Optional structured scope conditions.
bucketDuration
string
Required for time series; positive interval such as 1m.
valueField
string
Numeric result alias to chart. Set it explicitly when the query produces several numeric columns.
fillValue
number
Optional replacement for empty time buckets; omitted buckets have null values.
count() counts measurement intervals. Use sum(calls) to count database executions, and sum(exec_seconds) for cumulative execution time in seconds.
Example: Most Expensive Statements
The response wraps rows in data and lists numeric columns in valueFieldHints:
The response values above are illustrative. Other useful grouping fields include server_address, server_port, and db_system.
Example: Database Calls over Time
Time-series responses are arrays of objects with metric labels and a velocity array of timestamp/value points, rather than the search envelope. The query must aggregate data; the endpoint adds time buckets. See Time-Series Queries.
Errors
Invalid gcQL, unknown fields, reversed effective time bounds, non-positive buckets, or invalid value-field selection return HTTP 400. A backend that does not support statement measurements returns 404.
Last updated
