Skip to content
ClickHouse Docs
ClickHouse DocsClickHouse Docs

Get a Postgres slow query pattern with recent executions

Beta
GET/v1/organizations/{organizationId}/postgres/{postgresId}/slowQueryPatterns/{queryId}

This endpoint is in beta. API contract is stable, and no breaking changes are expected in the future.

Returns aggregate metrics for a single slow query pattern together with its most recent individual executions.

Authorizations

Path parameters

  • organizationIdstringrequired

    ID of the organization that owns the Postgres service.

    format: uuid
  • postgresIdstringrequired

    ID of the requested Postgres service.

    format: uuid
  • queryIdstringrequired

    Stable identifier for the query pattern.

Query parameters

  • db_namestringrequired

    Database name filter.

  • db_userstringrequired

    Database user filter.

  • db_operationstringrequired

    Database operation filter (for example, SELECT, INSERT, UPDATE, DELETE, UTILITY).

  • appoptionalstring

    Application name filter.

  • timestampoptionalstring

    Timestamp of a specific execution (RFC 3339).

    format: date-time

Response

JSON

200

Successful response

JSON
  • statusoptionalnumber

    HTTP status code.

    Example: 200
  • requestIdoptionalstring

    Unique id assigned to every request. UUIDv4

    format: uuid
  • resultoptionalobject
    2 properties
    • recentExecutionsarray ofobjectrequired

      Recent individual executions matching the pattern.

      43 properties
      • timestampstringrequired

        Execution timestamp (RFC 3339).

        format: date-time
      • queryIdstringrequired

        Stable identifier for the query pattern.

      • dbNamestringrequired

        Database the query ran in.

      • dbUserstringrequired

        Database user that executed the query.

      • dbOperationstringrequired

        Top-level SQL operation type.

      • appstringrequired

        Value of the Postgres application_name for this execution.

      • queryTextstringrequired

        Normalized query text for this execution.

      • pidstringrequired

        Postgres backend process ID that executed the query.

      • durationUsintegerrequired

        Execution duration in microseconds.

      • rowsintegerrequired

        Rows returned or affected.

      • sharedBlksHitintegerrequired

        Shared buffer blocks hit.

      • sharedBlksReadintegerrequired

        Shared buffer blocks read from disk.

      • sharedBlksWrittenintegerrequired

        Shared buffer blocks written.

      • sharedBlksDirtiedintegerrequired

        Shared buffer blocks dirtied.

      • sharedBlkReadTimeUsintegerrequired

        Time spent reading shared blocks, in microseconds.

      • sharedBlkWriteTimeUsintegerrequired

        Time spent writing shared blocks, in microseconds.

      • localBlksHitintegerrequired

        Local buffer blocks hit (temp tables).

      • localBlksReadintegerrequired

        Local buffer blocks read (temp tables).

      • localBlksWrittenintegerrequired

        Local buffer blocks written (temp tables).

      • localBlksDirtiedintegerrequired

        Local buffer blocks dirtied (temp tables).

      • tempBlksReadintegerrequired

        Temp blocks read (spills to disk).

      • tempBlksWrittenintegerrequired

        Temp blocks written (spills to disk).

      • tempBlkReadTimeUsintegerrequired

        Time spent reading temp blocks, in microseconds.

      • tempBlkWriteTimeUsintegerrequired

        Time spent writing temp blocks, in microseconds.

      • walRecordsintegerrequired

        Number of WAL records produced.

      • walBytesintegerrequired

        Number of WAL bytes produced.

      • walFpiintegerrequired

        Number of WAL full-page images produced.

      • cpuUserTimeUsintegerrequired

        CPU time spent in user mode, in microseconds.

      • cpuSysTimeUsintegerrequired

        CPU time spent in kernel mode, in microseconds.

      • jitFunctionsintegerrequired

        Number of JIT-compiled functions.

      • jitGenerationTimeUsintegerrequired

        JIT generation time, in microseconds.

      • jitInliningTimeUsintegerrequired

        JIT inlining time, in microseconds.

      • jitOptimizationTimeUsintegerrequired

        JIT optimization time, in microseconds.

      • jitEmissionTimeUsintegerrequired

        JIT emission time, in microseconds.

      • jitDeformTimeUsintegerrequired

        JIT deform time, in microseconds.

      • parallelWorkersPlannedintegerrequired

        Parallel workers planned for this execution.

      • parallelWorkersLaunchedintegerrequired

        Parallel workers actually launched for this execution.

      • serverRolestringrequired

        Role of the server that executed the query (for example, primary or standby).

      • errMessageoptionalstring

        Error message if the execution raised an error.

      • errSqlstateoptionalstring

        Postgres SQLSTATE code if the execution raised an error.

      • errEleveloptionalinteger

        Postgres error severity level if the execution raised an error.

      • traceIdoptionalstring

        OpenTelemetry trace ID associated with the execution.

      • spanIdoptionalstring

        OpenTelemetry span ID associated with the execution.

    • aggregateoptionalobject
      19 properties
      • queryIdstringrequired

        Stable identifier for the query pattern (normalized SQL).

      • queryTextstringrequired

        Normalized query text with literals replaced by placeholders.

      • dbNamestringrequired

        Database the query ran in.

      • dbUserstringrequired

        Database user that executed the query.

      • dbOperationstringrequired

        Top-level SQL operation type (for example, SELECT, INSERT, UPDATE, DELETE, UTILITY).

      • appstringrequired

        Value of the Postgres application_name for executions matching this pattern.

      • callCountintegerrequired

        Number of times the pattern executed in the window.

      • errorCountintegerrequired

        Number of executions of the pattern that raised an error.

      • totalDurationUsintegerrequired

        Total execution time across all calls, in microseconds.

      • avgDurationUsintegerrequired

        Average execution time per call, in microseconds.

      • maxDurationUsintegerrequired

        Maximum execution time of any call, in microseconds.

      • p50DurationUsintegerrequired

        50th percentile execution time, in microseconds.

      • p95DurationUsintegerrequired

        95th percentile execution time, in microseconds.

      • p99DurationUsintegerrequired

        99th percentile execution time, in microseconds.

      • totalRowsintegerrequired

        Total number of rows returned or affected across all calls.

      • totalSharedBlksReadintegerrequired

        Total shared buffer blocks read from disk (cache misses) across all calls.

      • totalSharedBlksHitintegerrequired

        Total shared buffer blocks hit (cache hits) across all calls.

      • totalCpuTimeUsintegerrequired

        Total CPU time across all calls, in microseconds.

      • totalWalBytesintegerrequired

        Total WAL (write-ahead log) bytes generated across all calls.

Navigation