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

# Insights

> Per-query latency and throughput for the database, slowest first. Reports the instance's latest drain (calls, total/mean time, p50/p99, rows read/written).



## OpenAPI

````yaml /openapi.json get /v1/orgs/{orgId}/projects/{projectId}/databases/{databaseId}/insights/queries
openapi: 3.1.0
info:
  title: Korve API
  version: 0.1.0
  description: >-
    Typed control plane for deploying applications and explicitly provisioning
    their managed infrastructure.
servers:
  - url: https://api.korve.dev
security: []
paths:
  /v1/orgs/{orgId}/projects/{projectId}/databases/{databaseId}/insights/queries:
    get:
      tags:
        - databases
      summary: Insights
      description: >-
        Per-query latency and throughput for the database, slowest first.
        Reports the instance's latest drain (calls, total/mean time, p50/p99,
        rows read/written).
      operationId: databases.insights
      parameters:
        - name: orgId
          in: path
          required: true
          schema:
            type: string
          description: The organization's id (UUID) or slug — either form is accepted.
        - name: projectId
          in: path
          required: true
          schema:
            type: string
          description: The project's id (UUID) or slug — either form is accepted.
        - name: databaseId
          in: path
          required: true
          schema:
            type: string
          description: The database's id (UUID), from databases.list.
        - name: limit
          in: query
          required: false
          schema:
            type: integer
          description: Maximum queries returned (1-100). Defaults to 50.
      responses:
        '200':
          description: Query stats, slowest first.
          content:
            application/json:
              schema:
                type: array
                items:
                  type: object
                  properties:
                    queryId:
                      type:
                        - string
                        - 'null'
                      description: Stable identifier of the normalized statement.
                    normalizedSql:
                      type:
                        - string
                        - 'null'
                      description: The statement with literals parameterized.
                    calls:
                      type:
                        - integer
                        - 'null'
                      description: Times the statement ran in the window.
                    totalTimeMs:
                      type:
                        - number
                        - 'null'
                      description: Total execution time across all calls, in milliseconds.
                    meanMs:
                      type:
                        - number
                        - 'null'
                      description: Mean execution time, in milliseconds.
                    p50Ms:
                      type:
                        - number
                        - 'null'
                      description: Median (p50) execution time, in milliseconds.
                    p99Ms:
                      type:
                        - number
                        - 'null'
                      description: 99th-percentile execution time, in milliseconds.
                    rowsRead:
                      type:
                        - integer
                        - 'null'
                      description: Rows read across all calls.
                    rowsWritten:
                      type:
                        - integer
                        - 'null'
                      description: Rows written across all calls.
                    capturedAt:
                      type: string
                      format: date-time
                      description: When this drain was captured.
                  required:
                    - queryId
                    - normalizedSql
                    - calls
                    - totalTimeMs
                    - meanMs
                    - p50Ms
                    - p99Ms
                    - rowsRead
                    - rowsWritten
                    - capturedAt
        '404':
          description: No such database in this project.
        '422':
          description: Invalid limit.
      security:
        - apiKey: []
        - session: []
components:
  securitySchemes:
    apiKey:
      type: http
      scheme: bearer
      bearerFormat: korve_api_key
    session:
      type: apiKey
      in: cookie
      name: korve.session_token

````