rds.data.query-stats

Top statements by time, calls or rows from pg_stat_statements; installed: false until the extension is on

GET /rds/api/instances/{id}/query-statsIAM rds:DescribeDBQueryStatsReadSensitive read, audited

Request syntax

GET /rds/api/instances/{id}/query-stats

Path parameters

  • idRequired

    string

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

Query parameters

  • orderOptional

    enum

    What the statements are ranked by; total_time when omitted

    One of: total_time, mean_time, calls, rows

    Default: "total_time"

  • limitOptional

    number

    At most this many statements; 25 when omitted

    Constraints: integer, 1-100

    Default: 25

Response

200 with { installed: false }, or { installed: true, since, statements }: each with queryId, query, calls, totalMs, meanMs, rows, cacheHitRatio and user.

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

Fields of data

  • installedWhen present

    false

    pg_stat_statements is installed in the database (false here)
  • sinceWhen present

    string, may be null

    When the statistics were last reset; null: unknown
  • statementsWhen present

    array of object

    The top statements in the order asked for
  • statements[].​queryIdWhen present

    string, may be null

    PostgreSQL query id
  • statements[].​queryWhen present

    string

    Normalised statement text, cut at 2,000 characters
  • statements[].​callsWhen present

    number

    Calls
  • statements[].​totalMsWhen present

    number

    Time spent, ms
  • statements[].​meanMsWhen present

    number

    Time per call, ms
  • statements[].​rowsWhen present

    number

    Rows returned or affected
  • statements[].​cacheHitRatioWhen present

    number, may be null

    Share of blocks served from memory, 0 to 1; null: nothing read
  • statements[].​userWhen present

    string, may be null

    Role it ran as

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:DescribeDBQueryStats 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 data query-stats id

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