---
title: "Fetch PostgreSQL service query statistics"
method: POST
path: "/project/{project}/service/{service_name}/pg/query/stats"
tags: ["Service:_PostgreSQL"]
---

# Fetch PostgreSQL service query statistics

`POST /project/{project}/service/{service_name}/pg/query/stats`

## Path parameters

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

## Request body

- PGServiceQueryStatisticsRequestBody — PGServiceQueryStatisticsRequestBody
  - `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. Accepted sort columns are: blk_read_time, blk_write_time, calls, database_name, local_blks_dirtied, local_blks_hit, local_blks_read, local_blks_written, max_plan_time, max_time, mean_plan_time, mean_time, min_plan_time, min_time, query, queryid, rows, shared_blks_dirtied, shared_blks_hit, shared_blks_read, shared_blks_written, stddev_plan_time, stddev_time, temp_blks_read, temp_blks_written, total_plan_time, total_time, user_name, wal_bytes, wal_fpi, wal_records

## Response `200`

Response

- PGServiceQueryStatisticsResponse — PGServiceQueryStatisticsResponse
  - `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 query statistics
    - `blk_read_time` number — Query statistic
    - `blk_write_time` number — Query statistic
    - `calls` number — Query statistic
    - `database_name` string — Query statistic
    - `local_blks_dirtied` number — Query statistic
    - `local_blks_hit` number — Query statistic
    - `local_blks_read` number — Query statistic
    - `local_blks_written` number — Query statistic
    - `max_plan_time` number — Query statistic
    - `max_time` number — Query statistic
    - `mean_plan_time` number — Query statistic
    - `mean_time` number — Query statistic
    - `min_plan_time` number — Query statistic
    - `min_time` number — Query statistic
    - `query` string — Query statistic
    - `queryid` number — Query statistic
    - `rows` number — Query statistic
    - `shared_blks_dirtied` number — Query statistic
    - `shared_blks_hit` number — Query statistic
    - `shared_blks_read` number — Query statistic
    - `shared_blks_written` number — Query statistic
    - `stddev_plan_time` number — Query statistic
    - `stddev_time` number — Query statistic
    - `temp_blks_read` number — Query statistic
    - `temp_blks_written` number — Query statistic
    - `total_plan_time` number — Query statistic
    - `total_time` number — Query statistic
    - `user_name` string — Query statistic
    - `wal_bytes` string — Query statistic
    - `wal_fpi` number — Query statistic
    - `wal_records` number — Query statistic

---

[API](https://skmtc.dev/aiven/apis/aiven-api-documentation.md) · [All operations](https://skmtc.dev/aiven/apis/aiven-api-documentation/llms.txt) · [OpenAPI document](https://skmtc-service-production.skmtc.workers.dev/v1/apis/aiven/aiven-api-documentation/revisions/6577fedfd4a2/schema)
