rds.query-insights.list-sessions

Client sessions now: what runs, how long, what it waits for, who blocks it

GET /rds/api/instances/{id}/insights/sessionsIAM rds:DescribeDBQueryInsightsRead

Request syntax

GET /rds/api/instances/{id}/insights/sessions

Path parameters

  • idRequired

    string

    Constraints: 3-64 chars, /^(?!ewdoc-)[a-z0-9-]+$/

Response

200 with { at, sessions }: each session’s pid, user, database, application, client, state, waitType, waitEvent, query, querySeconds, transactionSeconds, blockedBy and findings.

A JSON response is wrapped as { "success": true, "data": … }; the CLI prints the whole body with --json.

Fields of data

  • atAlways

    string

    When the sessions were read
  • sessionsAlways

    array of object

    Client sessions, up to 200
  • sessions[].​pidAlways

    number

    Server process id, for cancel-session
  • sessions[].​userAlways

    string, may be null

    Role
  • sessions[].​databaseAlways

    string, may be null

    Database
  • sessions[].​applicationAlways

    string, may be null

    application_name the client set
  • sessions[].​clientAlways

    string, may be null

    Client address
  • sessions[].​stateAlways

    string, may be null

    active, idle, idle in transaction, …
  • sessions[].​waitTypeAlways

    string, may be null

    Kind of wait, e.g. Lock
  • sessions[].​waitEventAlways

    string, may be null

    What it waits for
  • sessions[].​queryAlways

    string, may be null

    Current or last statement; normalised unless values are kept
  • sessions[].​querySecondsAlways

    number, may be null

    Seconds the statement has run
  • sessions[].​transactionSecondsAlways

    number, may be null

    Seconds the transaction has been open
  • sessions[].​blockedByAlways

    array of number

    Process ids holding the locks it waits for
  • sessions[].​findingsAlways

    array of object

    Findings with suggested actions
  • sessions[].​findings[].​kindAlways

    one of slow-average, slow-sometimes, missing-index, spills-to-disk, n-plus-one, seq-scan-large-table, unused-index, duplicate-index, vacuum-overdue, long-running, idle-in-transaction, lock-wait

    What was found
  • sessions[].​findings[].​severityAlways

    one of high, medium, info

    How much it matters
  • sessions[].​findings[].​titleAlways

    string

    One line: what was seen
  • sessions[].​findings[].​evidenceAlways

    string

    The numbers behind it
  • sessions[].​findings[].​actionAlways

    string

    What to do about it
  • sessions[].​findings[].​sqlWhen present

    string

    A statement to copy and run yourself (CREATE INDEX CONCURRENTLY, …); absent when none

Checked against the handlers: every route test validates their answers against this schema.

Errors

  • 400The request does not pass the schema above. The body is { "error": …, "issues": […] }, one issue per field.
  • 401No credentials, or an access key that is unknown, revoked or expired.
  • 403The caller's policies do not allow rds:DescribeDBQueryInsights on this resource. The body names the action and the resource, and the refusal is recorded in the audit log.
  • 404The resource does not exist in your organization.

Examples

The required parameters only, with example values. Replace id and the other placeholders with your own.

dcloud rds query-insights list-sessions id

Generated from the API description, the same one the API checks requests against and the CLI is built from. MCP tool: dcloud_rds_query-insights_list-sessions.