---
title: "List slow queries"
method: GET
path: "/instances/{id}/slow-queries"
tags: ["Query Insights"]
---

# List slow queries

`GET /instances/{id}/slow-queries`

## Request

- Base URL: `https://api.cloudpepper.io`
- URL: `https://api.cloudpepper.io/instances/{id}/slow-queries`
- Auth: HTTP bearer

Returns the slowest statements for the instance database from pg_stat_statements, ordered by the selected metric, with query text redacted of literals. Read-only (each call runs in a READ ONLY transaction with statement and lock timeouts). Requires the host to have query insights enabled (pg_stat_statements preloaded); otherwise the endpoint returns HTTP 409 and the body carries a machine-readable `reason`.

**Key Parameters:**
- `id`: The instance whose database to inspect
- `sort`: Which metric to order by
- `limit`: How many rows to return

## Response `200`

Slow queries retrieved successfully

- object

## Other responses

- `400`: Invalid request parameters
- `404`: Instance not found
- `409`: Query insights not enabled on this host (see body `reason`)

---

[API](https://skmtc.dev/cloudpepper/apis/cloudpepper-api-docs.md) · [All operations](https://skmtc.dev/cloudpepper/apis/cloudpepper-api-docs/llms.txt) · [OpenAPI document](https://skmtc.dev/cloudpepper/apis/cloudpepper-api-docs/revisions/b6a59274cedc?raw)
