Skip to content

Queries

All operations require authentication.

5 operationsv2/publicCloud/project
Agent setup

List running queriesBeta

GET
/v2/publicCloud/project/{projectId}/managedDatabase/mysql/{serviceId}/currentQueries

Returns the queries running on the service, with their client, user, state and duration.

Path parameters

projectId
required
string

Project ID

serviceId
required
stringuuid

Service ID

Headers

X-Pagination-Cursor
string

Pagination cursor

X-Pagination-Size
integer

Pagination size

Response

200CurrentQuery[]successful operation
applicationName
read-only
string

Name of the application that initiated the query

backendStartedAt
read-only
stringdate-time

Timestamp when the backend process started

clientIp
read-only
ip

IP address of the client

clientPort
read-only
integer

Port of the client connection

databaseName
read-only
string

Name of the database the query is running on

pid
read-only
integer

Process ID of the connection

query
read-only
string

SQL text of the currently running query

queryDuration
read-only
number

Duration of the query in seconds

queryStartedAt
read-only
stringdate-time

Timestamp when the query started

state
read-only
CurrentQueryStateEnum

Current state of the connection

ValuesACTIVEDISABLEDFASTPATH_FUNCTION_CALLIDLEIDLE_IN_TRANSACTIONIDLE_IN_TRANSACTION_ABORTED
userName
read-only
string

Name of the user running the query

waitEvent
read-only
string

Name of the wait event the connection is waiting on, if any

waitEventType
read-only
CurrentQueryWaitEventTypeEnum

Type of wait event the connection is waiting on, if any

ValuesACTIVITYBUFFER_PINCLIENTEXTENSIONIOIPCLOCKLWLOCKTIMEOUT

Example uses projectId = string, serviceId = 00000000-0000-0000-0000-000000000000

$ curl https://api.eu.ovhcloud.com/v2/publicCloud/project/{projectId}/managedDatabase/mysql/{serviceId}/currentQueries \
  -H "authorization: Bearer $OVH_TOKEN"
ResponseExample
[ { "applicationName": "string", "backendStartedAt": "2024-01-01T12:00:00Z", "clientIp": "192.0.2.0", "clientPort": 0, "databaseName": "string", "pid": 0, "query": "string", "queryDuration": 0, "queryStartedAt": "2024-01-01T12:00:00Z", "state": "ACTIVE", "userName": "string", "waitEvent": "string", "waitEventType": "ACTIVITY" }]

Get a running queryBeta

GET
/v2/publicCloud/project/{projectId}/managedDatabase/mysql/{serviceId}/currentQueries/{queryPid}

Returns the SQL text, state and duration of a running query, identified by its process ID.

Path parameters

projectId
required
string

Project ID

queryPid
required
integer

Query pid

serviceId
required
stringuuid

Service ID

Query parameters

limit
integer

Maximum number of queries to return

offset
integer

Number of queries to skip before returning results

Response

200CurrentQuerysuccessful operation
applicationName
read-only
string

Name of the application that initiated the query

backendStartedAt
read-only
stringdate-time

Timestamp when the backend process started

clientIp
read-only
ip

IP address of the client

clientPort
read-only
integer

Port of the client connection

databaseName
read-only
string

Name of the database the query is running on

pid
read-only
integer

Process ID of the connection

query
read-only
string

SQL text of the currently running query

queryDuration
read-only
number

Duration of the query in seconds

queryStartedAt
read-only
stringdate-time

Timestamp when the query started

state
read-only
CurrentQueryStateEnum

Current state of the connection

ValuesACTIVEDISABLEDFASTPATH_FUNCTION_CALLIDLEIDLE_IN_TRANSACTIONIDLE_IN_TRANSACTION_ABORTED
userName
read-only
string

Name of the user running the query

waitEvent
read-only
string

Name of the wait event the connection is waiting on, if any

waitEventType
read-only
CurrentQueryWaitEventTypeEnum

Type of wait event the connection is waiting on, if any

ValuesACTIVITYBUFFER_PINCLIENTEXTENSIONIOIPCLOCKLWLOCKTIMEOUT

Example uses projectId = string, queryPid = 0, serviceId = 00000000-0000-0000-0000-000000000000

$ curl https://api.eu.ovhcloud.com/v2/publicCloud/project/{projectId}/managedDatabase/mysql/{serviceId}/currentQueries/{queryPid} \
  -H "authorization: Bearer $OVH_TOKEN"
ResponseExample
{ "applicationName": "string", "backendStartedAt": "2024-01-01T12:00:00Z", "clientIp": "192.0.2.0", "clientPort": 0, "databaseName": "string", "pid": 0, "query": "string", "queryDuration": 0, "queryStartedAt": "2024-01-01T12:00:00Z", "state": "ACTIVE", "userName": "string", "waitEvent": "string", "waitEventType": "ACTIVITY"}

Cancel a running queryBeta

POST
/v2/publicCloud/project/{projectId}/managedDatabase/mysql/{serviceId}/currentQueries/{queryPid}/cancel

Cancels a running query gracefully. Set terminate to true to force its termination instead.

Path parameters

projectId
required
string

Project ID

queryPid
required
integer

Query pid

serviceId
required
stringuuid

Service ID

Request body (required)

terminate
boolean

Whether to forcefully terminate the query instead of gracefully canceling it

Response

200QueryCancelResultsuccessful operation
success
read-only
boolean

Whether the query was successfully canceled

Example uses projectId = string, queryPid = 0, serviceId = 00000000-0000-0000-0000-000000000000

$ curl https://api.eu.ovhcloud.com/v2/publicCloud/project/{projectId}/managedDatabase/mysql/{serviceId}/currentQueries/{queryPid}/cancel \
  -H "authorization: Bearer $OVH_TOKEN"
ResponseExample
{ "success": true}

List query statisticsBeta

GET
/v2/publicCloud/project/{projectId}/managedDatabase/mysql/{serviceId}/queryStatistics

Returns execution statistics for each query pattern: number of calls, rows and execution times.

Path parameters

projectId
required
string

Project ID

serviceId
required
stringuuid

Service ID

Query parameters

limit
integer

Maximum number of entries to return

offset
integer

Number of entries to skip before returning results

Headers

X-Pagination-Cursor
string

Pagination cursor

X-Pagination-Size
integer

Pagination size

Response

200QueryStatistic[]successful operation
calls
read-only
integer

Number of times this query pattern has been executed

databaseName
read-only
string

Name of the database

digest
read-only
string

Digest hash of the normalized query

firstSeen
read-only
stringdate-time

Timestamp of the first execution

lastSeen
read-only
stringdate-time

Timestamp of the most recent execution

maxTime
read-only
number

Maximum execution time in milliseconds

meanTime
read-only
number

Mean execution time in milliseconds

minTime
read-only
number

Minimum execution time in milliseconds

query
read-only
string

Representative SQL text of the query pattern

rows
read-only
integer

Total number of rows retrieved or affected

totalTime
read-only
number

Total cumulative execution time in milliseconds

username
read-only
string

Name of the user who executed the query

Example uses projectId = string, serviceId = 00000000-0000-0000-0000-000000000000

$ curl https://api.eu.ovhcloud.com/v2/publicCloud/project/{projectId}/managedDatabase/mysql/{serviceId}/queryStatistics \
  -H "authorization: Bearer $OVH_TOKEN"
ResponseExample
[ { "calls": 0, "databaseName": "string", "digest": "string", "firstSeen": "2024-01-01T12:00:00Z", "lastSeen": "2024-01-01T12:00:00Z", "maxTime": 0, "meanTime": 0, "minTime": 0, "query": "string", "rows": 0, "totalTime": 0, "username": "string" }]

Reset query statisticsBeta

POST
/v2/publicCloud/project/{projectId}/managedDatabase/mysql/{serviceId}/queryStatistics/reset

Resets all aggregated query statistics of the service.

Path parameters

projectId
required
string

Project ID

serviceId
required
stringuuid

Service ID

Response

200—successful operation

Example uses projectId = string, serviceId = 00000000-0000-0000-0000-000000000000

$ curl https://api.eu.ovhcloud.com/v2/publicCloud/project/{projectId}/managedDatabase/mysql/{serviceId}/queryStatistics/reset \
  -H "authorization: Bearer $OVH_TOKEN"