---
title: "List Postgres blocking queries"
method: GET
path: "/v1/organizations/{organizationId}/postgres/{postgresId}/blockingQueries"
tags: ["Postgres"]
---

# List Postgres blocking queries

`GET /v1/organizations/{organizationId}/postgres/{postgresId}/blockingQueries`

## Request

- Base URL: `https://api.clickhouse.cloud`
- URL: `https://api.clickhouse.cloud/v1/organizations/{organizationId}/postgres/{postgresId}/blockingQueries`
- Auth: HTTP basic

**This endpoint is in beta.** API contract is stable, and no breaking changes are expected in the future. <br /><br /> Returns which queries waited on locks held by other queries on a Postgres service during the given time window. Each item groups one waiting query with one direct blocker, most-sampled first. Groups come only from periods when blocking query collection was on for the service; turn it on in the console. Results are paginated with `limit`/`offset` and include `totalCount`. The time range must not exceed 31 days, and `to_date` must be after `from_date`.

## Path parameters

- `organizationId` string, uuid, required
- `postgresId` string, uuid, required

## Query parameters

- `from_date` string, date-time, required
- `to_date` string, date-time, required
- `db_name` string
- `db_user` string
- `app` string
- `limit` integer
- `offset` integer

## Response `200`

Successful response

- object
  - `status` number: HTTP status code.
  - `requestId` string, uuid: Unique id assigned to every request. UUIDv4
  - `result` PostgresBlockingQuery[]: List of results.
    - `database` string, required: Database of the waiting sessions.
    - `blockedQueryId` string, required: Query ID of the waiting statement, as in slow query patterns. Empty when Postgres had none yet; the group is then a single waiting session.
    - `blockedQuery` string, required: Normalized text of the waiting statement from Query Insights. Empty when no text is available.
    - `blockedUsers` string[], required: Database users of the waiting sessions (up to 10).
    - `blockedApps` string[], required: Non-empty `application_name` values of the waiting sessions (up to 10).
    - `blockedPids` integer[], required: Process IDs of the waiting sessions, most recently seen first (up to 10).
    - `lockType` string, required: Postgres lock type waited on at the latest sample (for example, relation, tuple, transactionid, advisory).
    - `blockedMode` string, required: Lock mode requested by the waiting session at the latest sample (for example, ShareLock).
    - `blockingDatabase` string, required: Database of the blocking session. Empty for a prepared transaction.
    - `blockingQueryId` string, required: Query ID of the blocking statement. Empty when the blocker had none; the group is then a single blocking session.
    - `blockingQuery` string, required: Normalized text of the blocking statement from Query Insights. Empty when no text is available.
    - `blockingUsers` string[], required: Database users of the blocking sessions (up to 10).
    - `blockingApps` string[], required: Non-empty `application_name` values of the blocking sessions (up to 10).
    - `blockingPids` integer[], required: Process IDs of the blocking sessions, most recently seen first (up to 10). A prepared transaction reports 0.
    - `blockingPrepared` boolean, required: True when the blocker is a prepared transaction, which has no session.
    - `blockingInternal` boolean, required: True when the blocker is a session the service uses internally, for example for monitoring or replication. Its query text is not returned.
    - `latestBlockingState` string, required: State of the blocking session at the latest sample (for example, active, idle in transaction).
    - `latestBlockingXactSeconds` number, nullable, required: Age of the blocking transaction at the latest sample, in seconds. `null` when not reported, as for a prepared transaction.
    - `latestBlockingBackendType` string, required: Postgres backend type of the blocker at the latest sample (for example, client backend, autovacuum worker).
    - `blockingSeenWaiting` boolean, required: True when the blocker was itself waiting on a lock in at least one sample.
    - `sessions` integer, required: Number of distinct waiting sessions in the group.
    - `samples` integer, required: Number of samples in which the group was seen.
    - `longestWaitSeconds` number, nullable, required: Longest observed wait of a waiting session, in seconds. `null` when no sample reported how long the session had waited.
    - `lastSeen` string, date-time, required: Time of the latest sample (RFC 3339).

## Other responses

- `400`: The request cannot be processed due to a client error. Please verify your request parameters and try again.
- `500`: An internal server error has occurred. If this issue persists, please contact ClickHouse Cloud support for assistance.

## Changes

- **2026-11-20** `6c2218858de8`: 1 info
  - endpoint added

[Operation history](https://skmtc.dev/clickhouse/apis/openapi-spec-for-clickhouse-cloud/changes/v1/organizations/:organizationId/postgres/:postgresId/blockingQueries/get.md)

---

[API](https://skmtc.dev/clickhouse/apis/openapi-spec-for-clickhouse-cloud.md) - [All operations](https://skmtc.dev/clickhouse/apis/openapi-spec-for-clickhouse-cloud/llms.txt) - [OpenAPI document](https://skmtc.dev/clickhouse/apis/openapi-spec-for-clickhouse-cloud/revisions/eac345053548?raw)
