Skip to main content

mysql_query_statistics

Creates, updates, deletes, gets or lists a mysql_query_statistics resource.

Overview​

Namemysql_query_statistics
TypeResource
Idovh.public_cloud_database.mysql_query_statistics

Fields​

The following fields are returned by SELECT queries:

Statistics for a single query pattern on a managed database service

NameDatatypeDescription
database_namestringName of the database (wire: databaseName)
callsintegerNumber of times this query pattern has been executed
digeststringDigest hash of the normalized query
first_seenstring (date-time)Timestamp of the first execution (wire: firstSeen)
last_seenstring (date-time)Timestamp of the most recent execution (wire: lastSeen)
max_timenumberMaximum execution time in milliseconds (wire: maxTime)
mean_timenumberMean execution time in milliseconds (wire: meanTime)
min_timenumberMinimum execution time in milliseconds (wire: minTime)
querystringRepresentative SQL text of the query pattern
rowsintegerTotal number of rows retrieved or affected
total_timenumberTotal cumulative execution time in milliseconds (wire: totalTime)
usernamestringName of the user who executed the query

Methods​

The following methods are available for this resource:

NameAccessible byRequired ParamsOptional ParamsDescription
listselectservice_id, project_idx_pagination_cursor, x_pagination_size, limit, offsetReturns execution statistics for each query pattern: number of calls, rows and execution times. (Beta version)
resetexecserviceId, project_idResets all aggregated query statistics of the service. (Beta version)

Parameters​

Parameters can be passed in the WHERE clause of a query. Check the Methods section to see which parameters are required or optional for each operation.

NameDatatypeDescription
api_hoststringThe OVHcloud API host. Selected by OVH_ENDPOINT (ovh-eu, ovh-ca or ovh-us; default ovh-eu). (default: api.eu.ovhcloud.com, x-stackQL-envVarSelector: {"envVar":"OVH_ENDPOINT","default":"ovh-eu","values":{"ovh-eu":"api.eu.ovhcloud.com","ovh-ca":"api.ca.ovhcloud.com","ovh-us":"api.us.ovhcloud.com"}})
project_idstringThe Public Cloud project ID. Resolved from OVH_CLOUD_PROJECT_SERVICE when set.
serviceIdstring (uuid)Service ID
service_idstring (uuid)Service ID (wire: serviceId)
limitintegerMaximum number of entries to return
offsetintegerNumber of entries to skip before returning results
x_pagination_cursorstringPagination cursor (wire: X-Pagination-Cursor)
x_pagination_sizeintegerPagination size (wire: X-Pagination-Size)

SELECT examples​

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

SELECT
database_name,
calls,
digest,
first_seen,
last_seen,
max_time,
mean_time,
min_time,
query,
rows,
total_time,
username
FROM ovh.public_cloud_database.mysql_query_statistics
WHERE service_id = '{{ service_id }}' -- required
AND project_id = '{{ project_id }}' -- required unless OVH_CLOUD_PROJECT_SERVICE is set
AND x_pagination_cursor = '{{ x_pagination_cursor }}'
AND x_pagination_size = '{{ x_pagination_size }}'
AND limit = '{{ limit }}'
AND offset = '{{ offset }}'
;

Lifecycle Methods​

EXEC variables use wire (API) names.

Resets all aggregated query statistics of the service. (Beta version)

EXEC ovh.public_cloud_database.mysql_query_statistics.reset
@serviceId='{{ serviceId }}' --required,
@project_id='{{ project_id }}' --required unless OVH_CLOUD_PROJECT_SERVICE is set
;