> ## Documentation Index
> Fetch the complete documentation index at: https://thenile.dev/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# List database query performance metrics

> Lists separately sourced Proxy query rate, Thoth observed query rate, and Thoth P99 query latency for a database.



## OpenAPI

````yaml https://global.thenile.dev/openapi.yaml?v=74222e6 get /workspaces/{workspaceSlug}/databases/{databaseId}/insights/query-performance
openapi: 3.0.1
info:
  title: Nile ReST API
  description: Making SaaS chill.
  contact:
    email: support@thenile.dev
  version: 0.1.0-74222e6
servers:
  - url: https://global.thenile.dev
security: []
paths:
  /workspaces/{workspaceSlug}/databases/{databaseId}/insights/query-performance:
    get:
      tags:
        - databases
      summary: List database query performance metrics
      description: >-
        Lists separately sourced Proxy query rate, Thoth observed query rate,
        and Thoth P99 query latency for a database.
      operationId: listDatabaseQueryPerformanceInsights
      parameters:
        - name: workspaceSlug
          in: path
          required: true
          schema:
            type: string
        - name: databaseId
          in: path
          required: true
          schema:
            type: string
        - name: start
          in: query
          schema:
            type: string
            description: Minute-aligned start of the metric window.
            format: date-time
        - name: end
          in: query
          schema:
            type: string
            description: Minute-aligned end of the metric window.
            format: date-time
        - name: granularity
          in: query
          schema:
            type: string
            description: 'Bucket granularity: 1m, 5m, 1h, or 1d.'
      responses:
        '200':
          description: Database query performance metrics.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/DatabaseQueryPerformanceResponse'
        '400':
          description: Invalid time range or granularity.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/APIError'
        '401':
          description: Unauthorized. Credentials were missing or expired.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/APIError'
        '404':
          description: Database not found in the workspace.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/APIError'
        '502':
          description: Regional metadata or Tinybird telemetry is unavailable.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/APIError'
        '503':
          description: Tinybird telemetry is not configured.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/APIError'
      security:
        - jwtBearerAuth: []
components:
  schemas:
    DatabaseQueryPerformanceResponse:
      type: object
      properties:
        source:
          type: string
        granularity:
          type: string
        points:
          type: array
          items:
            $ref: '#/components/schemas/DatabaseQueryPerformancePoint'
    APIError:
      required:
        - errorCode
        - message
        - statusCode
      type: object
      properties:
        errorCode:
          type: string
          enum:
            - internal_error
            - bad_request
            - unsupported_operation
            - forbidden_operation
            - entity_not_found
            - duplicate_entity
            - invalid_credentials
            - unknown_oidc_provider
            - unknown_oidc_party
            - provider_already_exists
            - provider_config_error
            - provider_mismatch
            - provider_update_error
            - provider_disabled
            - session_state_missing
            - session_state_mismatch
            - oidc_code_missing
            - tenant_not_found
            - constraint_violation
            - sql_exception
            - db_creation_failure
            - db_rename_failure
            - db_status_failure
            - db_initialization_failure
            - db_deletion_failure
            - db_config_missing
            - unauthorized_workspace_access
            - email_send_failure
            - jdbc_exception
            - oidc_exception
            - region_mismatch
            - credential_creation_failure
            - credential_propagation_failure
            - unauthorized_client
            - unsupported_response_type
            - invalid_request
            - server_error
            - access_denied
            - feature_ineligible
            - customer_lookup_failure
            - threshold_exceeded
            - create_rejected
        message:
          minLength: 1
          type: string
        statusCode:
          type: integer
          format: int32
    DatabaseQueryPerformancePoint:
      type: object
      properties:
        timestamp:
          type: string
          format: date-time
        proxyQueriesPerSecond:
          type: number
        thothQueriesPerSecond:
          type: number
        thothP99LatencyMs:
          type: number
        thothCpuMilliseconds:
          type: number
  securitySchemes:
    jwtBearerAuth:
      type: http
      scheme: bearer
      bearerFormat: JWT

````