---
title: "Fetch current queries for the service"
method: POST
path: "/project/{project}/service/{service_name}/query/activity"
tags: ["Service"]
---

# Fetch current queries for the service

`POST /project/{project}/service/{service_name}/query/activity`

## Path parameters

- `project` string, required
- `service_name` string, required

## Request body

- ServiceQueryActivityRequestBody — ServiceQueryActivityRequestBody
  - `limit` integer — Limit for number of results
  - `offset` integer — Offset for retrieved results based on sort order
  - `order_by` string — Sort order can be either asc or desc and multiple comma separated columns with their own order can be specified: :asc,:desc.

## Response `200`

Response

- ServiceQueryActivityResponse — ServiceQueryActivityResponse
  - `errors` object[] — List of errors occurred during request processing
    - `message` string, required — Printable error message
    - `more_info` string — URL to the documentation of the error
    - `status` integer, required — HTTP error status code
  - `message` string — Printable result of the request
  - `queries` object[], required — List of currently running queries and open connections
    - `active_channel_subscriptions` integer — Currently active channel subscriptions
    - `active_database` string — Selected database
    - `active_pattern_matching_channel_subscriptions` integer — Currently active channel subscriptions using pattern matching
    - `application_name` string — Application name when set
    - `backend_start` string — Timestamp in ISO 8601 format, always in UTC
    - `backend_type` string — Backend type
    - `backend_xid` integer — XID for current backend
    - `backend_xmin` integer — xmin for current backend
    - `client_addr` string — IP address:port pair. Not always available due to load balancers
    - `client_hostname` string — Client hostname
    - `client_port` integer — Client port, -1 is unknown
    - `connection_age_seconds` number — Connection age in seconds
    - `connection_idle_seconds` number — Connection idle time in seconds
    - `datid` integer — Database ID
    - `datname` string — Database name
    - `flags` string[] — Connection state flags
    - `flags_raw` string — Raw connection flags string
    - `id` string — Unique connection ID
    - `leader_pid` integer — Leader process ID
    - `multi_exec_commands` integer — Number of MULTI/EXEC comands
    - `name` string — Connection name, if specified
    - `output_buffer` integer — Output buffer length (disabled if 0)
    - `output_buffer_memory` integer — Output buffer memory
    - `output_list_length` integer — Output list, overflow for output buffering
    - `pid` integer — Connection process ID
    - `query` string — Last/current query running on this connection
    - `query_buffer` integer — Query buffer length (disabled if 0)
    - `query_buffer_free` integer — Free bytes in query buffer, if enabled
    - `query_duration` number — Duration of the last/current query in seconds
    - `query_id` integer — Hash code to identify identical normalized queries.
    - `query_start` string — Timestamp in ISO 8601 format, always in UTC
    - `state` string — Connection state
    - `state_change` string — Timestamp in ISO 8601 format, always in UTC
    - `usename` string — Username
    - `usesysid` integer — User ID
    - `wait_event` string — Connection wait event
    - `wait_event_type` string — Connection wait event type
    - `waiting` boolean — Query is waiting
    - `xact_start` string — Timestamp in ISO 8601 format, always in UTC

---

[API](https://skmtc.net/aiven/apis/aiven-api-documentation.md) · [All operations](https://skmtc.net/aiven/apis/aiven-api-documentation/llms.txt) · [OpenAPI document](https://skmtc-service-staging.skmtc.workers.dev/v1/apis/aiven/aiven-api-documentation/versions/ecaeabf1da31/schema)
