Get a Postgres slow query pattern with recent executions
This endpoint is in beta. API contract is stable, and no breaking changes are expected in the future.
Returns aggregate metrics for a single slow query pattern together with its most recent individual executions.
GET
/
v1
/
organizations
/
{organizationId}
/
postgres
/
{postgresId}
/
slowQueryPatterns
/
{queryId}
Get a Postgres slow query pattern with recent executions
curl --request GET \
--url https://api.clickhouse.cloud/v1/organizations/{organizationId}/postgres/{postgresId}/slowQueryPatterns/{queryId} \
--header 'Authorization: Basic <encoded-value>'import requests
url = "https://api.clickhouse.cloud/v1/organizations/{organizationId}/postgres/{postgresId}/slowQueryPatterns/{queryId}"
headers = {"Authorization": "Basic <encoded-value>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {Authorization: 'Basic <encoded-value>'}};
fetch('https://api.clickhouse.cloud/v1/organizations/{organizationId}/postgres/{postgresId}/slowQueryPatterns/{queryId}', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.clickhouse.cloud/v1/organizations/{organizationId}/postgres/{postgresId}/slowQueryPatterns/{queryId}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"Authorization: Basic <encoded-value>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://api.clickhouse.cloud/v1/organizations/{organizationId}/postgres/{postgresId}/slowQueryPatterns/{queryId}"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("Authorization", "Basic <encoded-value>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("https://api.clickhouse.cloud/v1/organizations/{organizationId}/postgres/{postgresId}/slowQueryPatterns/{queryId}")
.header("Authorization", "Basic <encoded-value>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.clickhouse.cloud/v1/organizations/{organizationId}/postgres/{postgresId}/slowQueryPatterns/{queryId}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["Authorization"] = 'Basic <encoded-value>'
response = http.request(request)
puts response.read_body{
"status": 200,
"requestId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"result": {
"recentExecutions": [
{
"timestamp": "2023-11-07T05:31:56Z",
"queryId": "<string>",
"dbName": "<string>",
"dbUser": "<string>",
"dbOperation": "<string>",
"app": "<string>",
"queryText": "<string>",
"pid": "<string>",
"durationUs": 123,
"rows": 123,
"sharedBlksHit": 123,
"sharedBlksRead": 123,
"sharedBlksWritten": 123,
"sharedBlksDirtied": 123,
"sharedBlkReadTimeUs": 123,
"sharedBlkWriteTimeUs": 123,
"localBlksHit": 123,
"localBlksRead": 123,
"localBlksWritten": 123,
"localBlksDirtied": 123,
"tempBlksRead": 123,
"tempBlksWritten": 123,
"tempBlkReadTimeUs": 123,
"tempBlkWriteTimeUs": 123,
"walRecords": 123,
"walBytes": 123,
"walFpi": 123,
"cpuUserTimeUs": 123,
"cpuSysTimeUs": 123,
"jitFunctions": 123,
"jitGenerationTimeUs": 123,
"jitInliningTimeUs": 123,
"jitOptimizationTimeUs": 123,
"jitEmissionTimeUs": 123,
"jitDeformTimeUs": 123,
"parallelWorkersPlanned": 123,
"parallelWorkersLaunched": 123,
"serverRole": "<string>",
"errMessage": "<string>",
"errSqlstate": "<string>",
"errElevel": 123,
"traceId": "<string>",
"spanId": "<string>"
}
],
"aggregate": {
"queryId": "<string>",
"queryText": "<string>",
"dbName": "<string>",
"dbUser": "<string>",
"dbOperation": "<string>",
"app": "<string>",
"callCount": 123,
"errorCount": 123,
"totalDurationUs": 123,
"avgDurationUs": 123,
"maxDurationUs": 123,
"p50DurationUs": 123,
"p95DurationUs": 123,
"p99DurationUs": 123,
"totalRows": 123,
"totalSharedBlksRead": 123,
"totalSharedBlksHit": 123,
"totalCpuTimeUs": 123,
"totalWalBytes": 123
}
}
}{
"status": 400,
"error": "<string>",
"requestId": "3c90c3cc-0d44-4b50-8888-8dd25736052a"
}{
"status": 500,
"error": "<string>",
"requestId": "3c90c3cc-0d44-4b50-8888-8dd25736052a"
}Beta
This endpoint is in beta. API contract is stable, and no breaking changes are expected in the future.
Returns aggregate metrics for a single slow query pattern together with its most recent individual executions.
Returns aggregate metrics for a single slow query pattern together with its most recent individual executions.
Authorizations
Use key ID and key secret obtained in ClickHouse Cloud console: https://clickhouse.com/docs/cloud/manage/openapi
Path Parameters
ID of the organization that owns the Postgres service.
ID of the requested Postgres service.
Stable identifier for the query pattern.
Query Parameters
Database name filter.
Database user filter.
Database operation filter (for example, SELECT, INSERT, UPDATE, DELETE, UTILITY).
Application name filter.
Timestamp of a specific execution (RFC 3339).
Last modified on July 9, 2026
Was this page helpful?
⌘I
Get a Postgres slow query pattern with recent executions
curl --request GET \
--url https://api.clickhouse.cloud/v1/organizations/{organizationId}/postgres/{postgresId}/slowQueryPatterns/{queryId} \
--header 'Authorization: Basic <encoded-value>'import requests
url = "https://api.clickhouse.cloud/v1/organizations/{organizationId}/postgres/{postgresId}/slowQueryPatterns/{queryId}"
headers = {"Authorization": "Basic <encoded-value>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {Authorization: 'Basic <encoded-value>'}};
fetch('https://api.clickhouse.cloud/v1/organizations/{organizationId}/postgres/{postgresId}/slowQueryPatterns/{queryId}', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.clickhouse.cloud/v1/organizations/{organizationId}/postgres/{postgresId}/slowQueryPatterns/{queryId}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"Authorization: Basic <encoded-value>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://api.clickhouse.cloud/v1/organizations/{organizationId}/postgres/{postgresId}/slowQueryPatterns/{queryId}"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("Authorization", "Basic <encoded-value>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("https://api.clickhouse.cloud/v1/organizations/{organizationId}/postgres/{postgresId}/slowQueryPatterns/{queryId}")
.header("Authorization", "Basic <encoded-value>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.clickhouse.cloud/v1/organizations/{organizationId}/postgres/{postgresId}/slowQueryPatterns/{queryId}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["Authorization"] = 'Basic <encoded-value>'
response = http.request(request)
puts response.read_body{
"status": 200,
"requestId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"result": {
"recentExecutions": [
{
"timestamp": "2023-11-07T05:31:56Z",
"queryId": "<string>",
"dbName": "<string>",
"dbUser": "<string>",
"dbOperation": "<string>",
"app": "<string>",
"queryText": "<string>",
"pid": "<string>",
"durationUs": 123,
"rows": 123,
"sharedBlksHit": 123,
"sharedBlksRead": 123,
"sharedBlksWritten": 123,
"sharedBlksDirtied": 123,
"sharedBlkReadTimeUs": 123,
"sharedBlkWriteTimeUs": 123,
"localBlksHit": 123,
"localBlksRead": 123,
"localBlksWritten": 123,
"localBlksDirtied": 123,
"tempBlksRead": 123,
"tempBlksWritten": 123,
"tempBlkReadTimeUs": 123,
"tempBlkWriteTimeUs": 123,
"walRecords": 123,
"walBytes": 123,
"walFpi": 123,
"cpuUserTimeUs": 123,
"cpuSysTimeUs": 123,
"jitFunctions": 123,
"jitGenerationTimeUs": 123,
"jitInliningTimeUs": 123,
"jitOptimizationTimeUs": 123,
"jitEmissionTimeUs": 123,
"jitDeformTimeUs": 123,
"parallelWorkersPlanned": 123,
"parallelWorkersLaunched": 123,
"serverRole": "<string>",
"errMessage": "<string>",
"errSqlstate": "<string>",
"errElevel": 123,
"traceId": "<string>",
"spanId": "<string>"
}
],
"aggregate": {
"queryId": "<string>",
"queryText": "<string>",
"dbName": "<string>",
"dbUser": "<string>",
"dbOperation": "<string>",
"app": "<string>",
"callCount": 123,
"errorCount": 123,
"totalDurationUs": 123,
"avgDurationUs": 123,
"maxDurationUs": 123,
"p50DurationUs": 123,
"p95DurationUs": 123,
"p99DurationUs": 123,
"totalRows": 123,
"totalSharedBlksRead": 123,
"totalSharedBlksHit": 123,
"totalCpuTimeUs": 123,
"totalWalBytes": 123
}
}
}{
"status": 400,
"error": "<string>",
"requestId": "3c90c3cc-0d44-4b50-8888-8dd25736052a"
}{
"status": 500,
"error": "<string>",
"requestId": "3c90c3cc-0d44-4b50-8888-8dd25736052a"
}