---
title: "Get database queries"
method: GET
path: "/projects/{id}/databases/{databaseName}/queries"
tags: ["Databases"]
---

# Get database queries

`GET /projects/{id}/databases/{databaseName}/queries`

## Request

- Base URL: `https://api.volcano.dev`
- URL: `https://api.volcano.dev/projects/{id}/databases/{databaseName}/queries`
- Auth: one of:
  - HTTP bearer
  - HTTP bearer

Returns the database's current top queries from pg_stat_statements
ranked by total execution time. Only data statements (SELECT, INSERT,
UPDATE, DELETE, MERGE) are listed; statements Volcano runs to operate
the database are left out.

**SUPERAGENT plan required.** This endpoint is only available to projects owned
by users on the SUPERAGENT billing plan.

## Path parameters

- `id` string, uuid, required
- `databaseName` string, required

## Query parameters

- `limit` integer

## Response `200`

Database query performance retrieved

- DatabaseQueryPerformanceResponse
  - `data` DatabaseQueryPerformanceItem[], required
    - `query_id` string, required: pg_stat_statements query identifier.
    - `query` string, required: Normalized representative query text with literal values replaced by `?`.
    - `database` DatabaseQueryPerformanceDatabase, required
      - `id` string, uuid, required
      - `name` string, required
    - `role` string, required: Postgres role that ran the query, such as `anon` or `authenticated` for RLS-enforced connections, `service_role`, the database owner role for full-access connections, or a role you created. `unknown` when the role no longer exists.
    - `calls` integer, required
    - `total_exec_time_seconds` number, double, required: Cumulative total execution time from pg_stat_statements in seconds.
    - `max_exec_time_seconds` number, double, required
    - `mean_exec_time_seconds` number, double, required
    - `min_exec_time_seconds` number, double, required
    - `rows_processed` integer, required

## Other responses

- `400`: Bad request - invalid query parameters
- `401`: Unauthorized - invalid or missing token
- `403`: Access denied
- `404`: Project or database not found
- `500`: Internal server error

## Changes

- **2026-10-07** `23e7875e7c4c`: 1 info
  - the endpoint scheme security `ProjectAccessToken` was added to the API
- **2026-09-19** `3a6f365f3f35`: 8 breaking, 11 info
  - added the new path request parameter `databaseName`
  - added the new path request parameter `id`
  - the response's body type changed from no type to `object` for status `200`
  - the response's body type changed from no type to `object` for status `400`
  - …15 more
- **2026-08-27** `bb44e98aba2e`: 12 breaking, 7 warning
  - the response's body type changed from `object` to no type for status `200`
  - the response's body type changed from `object` to no type for status `400`
  - the response's body type changed from `object` to no type for status `401`
  - the response's body type changed from `object` to no type for status `403`
  - …15 more
- **2026-07-27** `bb52784e098a`: 5 info
  - added the optional property `code` to the response with the `400` status
  - added the optional property `code` to the response with the `401` status
  - added the optional property `code` to the response with the `403` status
  - added the optional property `code` to the response with the `404` status
  - …1 more

[Operation history](https://skmtc.dev/kong/apis/volcano-api/changes/projects/:id/databases/:databaseName/queries/get.md)

---

[API](https://skmtc.dev/kong/apis/volcano-api.md) - [All operations](https://skmtc.dev/kong/apis/volcano-api/llms.txt) - [OpenAPI document](https://skmtc.dev/kong/apis/volcano-api/revisions/84c4488f91e9?raw)
