Cloady Docs
API ReferenceEndpointsApplications

Read a database's top statements

Returns the statements with the most time, the most calls and the slowest means, with their normalized text: pg_stat_statements on Postgres, performance_schema digests on MySQL and MariaDB, system.query_log over `range` on ClickHouse, per-collection totals on MongoDB. Statement text can carry data, so this needs the developer role. A one-shot read gives cumulative values; sending `Accept: text/event-stream` instead follows it live, a frame every fifteen seconds with calls and time over the interval.

GET
/api/workspaces/{workspaceSlug}/apps/{appSlug}/services/{serviceName}/engine/statements
AuthorizationBearer <token>

Personal API token (cldy_…)

In: header

Path Parameters

workspaceSlug*string
appSlug*string
serviceName*string

Query Parameters

env?string

Value in

  • "production"
  • "preview"
  • "development"
region?string
range?string

How far back to look; the answer has 30 to 96 points across it

Default"1h"

Value in

  • "15m"
  • "1h"
  • "6h"
  • "24h"
  • "7d"

Response Body

application/json

application/json

application/json

application/json

application/json

application/json

curl -X GET "https://example.com/api/workspaces/string/apps/string/services/string/engine/statements"
{  "ts": 0,  "engine": "postgres",  "interval": 0,  "since": 0,  "source": "pg_stat_statements",  "evicted": 0,  "hidden": 0,  "note": "string",  "statements": [    {      "id": "string",      "text": "string",      "database": "string",      "user": "string",      "calls": 0,      "totalMs": 0,      "rows": 0,      "meanMs": 0,      "maxMs": 0,      "stddevMs": 0,      "p95Ms": 0,      "p99Ms": 0,      "callsPerSec": 0,      "intervalMs": 0,      "noIndex": 0,      "missingIndex": true,      "lockMs": 0,      "lockWaits": 0,      "tables": [        "string"      ],      "since": 0    }  ]}