rds.query-insights.get

Statements of the range with load, trends and findings

GET /rds/api/instances/{id}/insightsIAM rds:DescribeDBQueryInsightsRead

Statement text is normalised (no literal values). Each statement carries its sqlfp1 fingerprint, the key Error Tracking links by.

Request syntax

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

Path parameters

  • idRequired

    string

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

Query parameters

  • rangeOptional

    enum

    1h by the minute, 24h by 15 minutes, 7d by 2 hours

    One of: 1h, 24h, 7d

    Default: "24h"

Response

200 with range, from, to, bucketSeconds, sampling, plansWithValues, errorTrackingUrl, the load series (at, totalMs, calls) and up to 200 statements: id, fingerprint, query, database, role, calls, totalMs, meanMs, maxMs, rows, cacheHitRatio, walBytes, series, findings, … .

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

Fields of data

  • rangeAlways

    one of 1h, 24h, 7d

    The range shown
  • fromAlways

    string

    Start of the range
  • toAlways

    string

    End of the range
  • bucketSecondsAlways

    number

    Width of one point of the series, seconds
  • samplingAlways

    object

    How the history is being sampled
  • sampling.​lastMinuteAlways

    string, may be null

    Newest minute sampled; null: nothing sampled in the range
  • sampling.​avgSampleMsAlways

    number, may be null

    Average time one sample took on the database, ms
  • sampling.​p95SampleMsAlways

    number, may be null

    95th percentile of that time, ms
  • plansWithValuesAlways

    boolean

    Whether statements and plans are kept with their literal values
  • errorTrackingUrlAlways

    string, may be null

    Console page linking statements to errors; null without an Error Tracking project
  • loadAlways

    array of object

    Load of the whole database over the range
  • load[].​atAlways

    string

    Start of the point
  • load[].​totalMsAlways

    number

    Time all statements spent, ms
  • load[].​callsAlways

    number

    Calls of all statements
  • statementsAlways

    array of object

    Up to 200 statements, by total time
  • statements[].​idAlways

    string

    Statement id, for get-statement
  • statements[].​fingerprintAlways

    string

    sqlfp1 fingerprint, the key Error Tracking links by
  • statements[].​queryAlways

    string

    Normalised statement text (no literal values)
  • statements[].​databaseAlways

    string

    Database it ran in
  • statements[].​roleAlways

    string

    Role it ran as
  • statements[].​firstSeenAtAlways

    string

    First time it was sampled
  • statements[].​lastSeenAtAlways

    string

    Last time it was sampled
  • statements[].​callsAlways

    number

    Calls in the range
  • statements[].​totalMsAlways

    number

    Time spent in the range, ms
  • statements[].​meanMsAlways

    number

    Time per call, ms
  • statements[].​maxMsAlways

    number, may be null

    Slowest call, ms; null: unknown
  • statements[].​stddevMsAlways

    number, may be null

    Standard deviation of a call, ms; null: unknown
  • statements[].​rowsAlways

    number

    Rows returned or affected
  • statements[].​rowsPerCallAlways

    number

    Rows per call
  • statements[].​cacheHitRatioAlways

    number, may be null

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

    number

    Blocks read from disk
  • statements[].​sharedBlocksHitAlways

    number

    Blocks served from memory
  • statements[].​tempBlocksWrittenAlways

    number

    Temporary blocks written: sorts and hashes that spilled to disk
  • statements[].​walBytesAlways

    number

    WAL written, bytes
  • statements[].​seriesAlways

    array of object

    Its own load over the range
  • statements[].​series[].​atAlways

    string

    Start of the point
  • statements[].​series[].​totalMsAlways

    number

    Time spent, ms
  • statements[].​series[].​callsAlways

    number

    Calls
  • statements[].​findingsAlways

    array of object

    Findings with suggested actions
  • statements[].​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
  • statements[].​findings[].​severityAlways

    one of high, medium, info

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

    string

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

    string

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

    string

    What to do about it
  • statements[].​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 get 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_get.