Cast AI Query Stats API
QueryStatsAPI provides operations for managing database query stats and execution plans
QueryStatsAPI provides operations for managing database query stats and execution plans
Every API here is available over the APIs.io API and to AI agents over MCP.
One button, every client — Claude, Cursor, VS Code and the rest.
https://apis.io/mcp
find_apisBrowse and filter every API in the catalog.get_api_artifactsOne API's artifacts, grouped by type.get_openapiThe primary OpenAPI for this API.find_similar_apisAPIs that look like this one.apis_io_searchSTART HERE — APIs, providers and tags for one query, each with its total.resolveTurn a domain, URL or GitHub org into the provider it belongs to.find_cohortsEvery scored population of providers in the catalog.curl "https://apis.io/api/v1/apis/kimchi:kimchi-querystatsapi-api"
curl "https://apis.io/api/v1/apis?limit=25"
Discovery needs no key. Ratings and market analysis are Pro.
Free tier, no form to fill in. Signing in shares your email address with us — we store it to create your key and to recognise you if you sign in with another provider. See our Privacy Policy and Terms.
A second provider on the same verified email joins the account you already have.
openapi: 3.2.0
info:
title: Database Optimizer Query Stats API
version: 0.0.1
description: QueryStatsAPI provides operations for managing database query stats and execution plans
servers:
- url: https://api.cast.ai/
description: US endpoint
- url: https://api.eu.cast.ai/
description: EU endpoint
security:
- BearerAuth: []
- ApiKeyAuth: []
tags:
- name: QueryStatsAPI
description: QueryStatsAPI provides operations for managing database query stats and execution plans
paths:
? /database-optimizer/index-advisor/v1alpha/organizations/{organizationId}/cache-groups/{cacheGroupId}/databases/{databaseName}/mysql-query-stats:batchCreate
: post:
tags:
- QueryStatsAPI
summary: Push MySQL query stats snapshots from collector
description: 'Push MySQL query stats snapshots
Stores MySQL query stats snapshots used to identify missing index opportunities.'
operationId: QueryStatsAPI_BatchCreateMySQLQueryStats
parameters:
- name: organizationId
in: path
description: Organization ID
required: true
schema:
type: string
- name: cacheGroupId
in: path
description: Cache group ID
required: true
schema:
type: string
- name: databaseName
in: path
description: Database name
required: true
schema:
type: string
requestBody:
content:
application/json:
schema:
$ref: '#/components/schemas/BatchCreateMySQLQueryStatsRequest'
required: true
responses:
'200':
description: OK
content:
application/json:
schema:
$ref: '#/components/schemas/BatchCreateMySQLQueryStatsResponse'
default:
description: Default error response
content:
application/json:
schema:
$ref: '#/components/schemas/Status'
? /database-optimizer/index-advisor/v1alpha/organizations/{organizationId}/cache-groups/{cacheGroupId}/databases/{databaseName}/pg-query-stats:batchCreate
: post:
tags:
- QueryStatsAPI
summary: Push PostgreSQL query stats snapshots from collector
description: 'Push PostgreSQL query stats snapshots
Stores cumulative PostgreSQL query stats snapshots. The server computes per-interval
deltas between consecutive snapshots, avoiding the need to reset pg_stat_statements.'
operationId: QueryStatsAPI_BatchCreatePgQueryStats
parameters:
- name: organizationId
in: path
description: Organization ID
required: true
schema:
type: string
- name: cacheGroupId
in: path
description: Cache group ID
required: true
schema:
type: string
- name: databaseName
in: path
description: Database name
required: true
schema:
type: string
requestBody:
content:
application/json:
schema:
$ref: '#/components/schemas/BatchCreateQueryStatsRequest'
required: true
responses:
'200':
description: OK
content:
application/json:
schema:
$ref: '#/components/schemas/BatchCreateQueryStatsResponse'
default:
description: Default error response
content:
application/json:
schema:
$ref: '#/components/schemas/Status'
? /database-optimizer/index-advisor/v1alpha/organizations/{organizationId}/cache-groups/{cacheGroupId}/databases/{databaseName}/query-stats:batchCreate
: post:
tags:
- QueryStatsAPI
summary: Batch create query stats for analysis
description: 'Batch create query stats for analysis
Stores query stats collected by pg_stat_statements and running EXPLAIN on query templates.
This data is used to identify index optimization opportunities.'
operationId: QueryStatsAPI_BatchCreateQueryStats
parameters:
- name: organizationId
in: path
description: Organization ID
required: true
schema:
type: string
- name: cacheGroupId
in: path
description: Cache group ID
required: true
schema:
type: string
- name: databaseName
in: path
description: Database name
required: true
schema:
type: string
requestBody:
content:
application/json:
schema:
$ref: '#/components/schemas/BatchCreateQueryStatsRequest'
required: true
responses:
'200':
description: OK
content:
application/json:
schema:
$ref: '#/components/schemas/BatchCreateQueryStatsResponse'
default:
description: Default error response
content:
application/json:
schema:
$ref: '#/components/schemas/Status'
components:
schemas:
Status:
type: object
properties:
code:
type: integer
description: The status code, which should be an enum value of [google.rpc.Code][google.rpc.Code].
format: int32
message:
type: string
description: A developer-facing error message, which should be in English. Any user-facing error message should be localized and sent in the [google.rpc.Status.details][google.rpc.Status.details] field, or localized by the client.
details:
type: array
items:
$ref: '#/components/schemas/GoogleProtobufAny'
description: A list of messages that carry the error details. There is a common set of message types for APIs to use.
description: 'The `Status` type defines a logical error model that is suitable for different programming environments, including REST APIs and RPC APIs. It is used by [gRPC](https://github.com/grpc). Each `Status` message contains three pieces of data: error code, error message, and error details. You can find out more about this error model and how to work with it in the [API Design Guide](https://cloud.google.com/apis/design/errors).'
BatchCreateMySQLQueryStatsRequest:
required:
- organizationId
- cacheGroupId
- databaseName
- requests
type: object
properties:
organizationId:
type: string
description: Organization ID
cacheGroupId:
type: string
description: Cache group ID
databaseName:
type: string
description: Database name
requests:
type: array
items:
$ref: '#/components/schemas/MySQLQueryStatsSnapshot'
description: MySQL query snapshot data
metadata:
allOf:
- $ref: '#/components/schemas/RequestMetadata'
description: Request metadata
description: Request to batch create MySQL query stats snapshots
BatchCreateQueryStatsRequest:
required:
- organizationId
- cacheGroupId
- databaseName
- requests
type: object
properties:
organizationId:
type: string
description: Organization ID
cacheGroupId:
type: string
description: Cache group ID
databaseName:
type: string
description: Database name
parent:
type: string
description: "Optional parent resource path. If not provided, will be auto-populated\n from organization_id and database_id as \"organizations/{organization_id}/databases/{database_id}\"\n If provided, must match the individual organization_id and database_id fields."
requests:
type: array
items:
$ref: '#/components/schemas/QueryStats'
description: "The request messages specifying the query stats to create.\n A maximum of 100 query stats can be created in a batch."
metadata:
allOf:
- $ref: '#/components/schemas/RequestMetadata'
description: Request metadata
statsResetTime:
type: string
description: "Timestamp of the last pg_stat_statements reset. Only present on Postgres 14+\n (queried from pg_stat_statements_info). Used by the server together with\n per-query counter comparisons to detect resets scoped to the monitored database."
format: date-time
description: Request to batch create query stats
QueryStats:
required:
- templateHash
- queryTemplate
- calls
- totalExecTimeMs
- meanExecTimeMs
- minExecTimeMs
- maxExecTimeMs
- stddevExecTimeMs
- rows
- sharedBlksHit
- sharedBlksRead
- sharedBlksWritten
- localBlksHit
- localBlksRead
- localBlksWritten
- tempBlksRead
- tempBlksWritten
- blkReadTimeMs
- blkWriteTimeMs
type: object
properties:
templateHash:
type: string
description: Template hash linking to query template
queryTemplate:
type: string
description: Normalized query template
calls:
type: string
description: Number of times the query has been called
totalExecTimeMs:
type: number
description: "Total time spent in execution, in milliseconds\n (-- api-linter: core::0142::time-field-type=disabled\n aip.dev/not-precedent: We need to do this because it's not a timestamp. --)"
format: double
meanExecTimeMs:
type: number
description: "Mean time spent in execution, in milliseconds\n (-- api-linter: core::0142::time-field-type=disabled\n aip.dev/not-precedent: We need to do this because it's not a timestamp. --)"
format: double
minExecTimeMs:
type: number
description: "Minimum time spent in execution, in milliseconds\n (-- api-linter: core::0142::time-field-type=disabled\n aip.dev/not-precedent: We need to do this because it's not a timestamp. --)"
format: double
maxExecTimeMs:
type: number
description: "Maximum time spent in execution, in milliseconds\n (-- api-linter: core::0142::time-field-type=disabled\n aip.dev/not-precedent: We need to do this because it's not a timestamp. --)"
format: double
stddevExecTimeMs:
type: number
description: "Population standard deviation of execution time, in milliseconds\n (-- api-linter: core::0142::time-field-type=disabled\n aip.dev/not-precedent: We need to do this because it's not a timestamp. --)"
format: double
rows:
type: string
description: Total number of rows retrieved or affected
sharedBlksHit:
type: string
description: Number of shared block hits (cache hits)
sharedBlksRead:
type: string
description: Number of shared blocks read from disk
sharedBlksWritten:
type: string
description: Number of shared blocks written
localBlksHit:
type: string
description: Number of local block hits
localBlksRead:
type: string
description: Number of local blocks read
localBlksWritten:
type: string
description: Number of local blocks written
tempBlksRead:
type: string
description: Temporary blocks read
tempBlksWritten:
type: string
description: Temporary blocks written
blkReadTimeMs:
type: number
description: "Time spent reading data file blocks, in milliseconds\n (-- api-linter: core::0142::time-field-type=disabled\n aip.dev/not-precedent: We need to do this because it's not a timestamp. --)"
format: double
blkWriteTimeMs:
type: number
description: "Time spent writing data file blocks, in milliseconds\n (-- api-linter: core::0142::time-field-type=disabled\n aip.dev/not-precedent: We need to do this because it's not a timestamp. --)"
format: double
description: Query with stats about the query, it's hash and execution plan
BatchCreateMySQLQueryStatsResponse:
type: object
properties: {}
description: Response from batch creating MySQL query stats snapshots
RequestMetadata:
type: object
properties:
requestId:
type: string
description: Request ID for tracing
clientVersion:
type: string
description: Client version information
collectorId:
type: string
description: Collection source identifier
source:
type: string
description: Request source information
description: Request metadata for tracing
MySQLQueryStatsSnapshot:
required:
- schemaName
- digest
- digestText
- countStar
- sumRowsSent
- sumRowsExamined
- sumNoIndexUsed
- firstSeen
- lastSeen
- sumTimerWait
- minTimerWait
- maxTimerWait
type: object
properties:
schemaName:
type: string
description: Schema name
digest:
type: string
description: MySQL performance_schema digest hash
digestText:
type: string
description: Normalized query text
countStar:
type: string
description: Cumulative number of times this digest was executed
sumRowsSent:
type: string
description: Cumulative number of rows sent to the client
sumRowsExamined:
type: string
description: Cumulative number of rows examined
sumNoIndexUsed:
type: string
description: Cumulative number of executions that used no index
firstSeen:
type: string
description: "When this digest was first seen by MySQL\n (-- api-linter: core::0142::time-field-names=disabled\n aip.dev/not-precedent: first_seen matches the MySQL performance_schema column name. --)"
format: date-time
lastSeen:
type: string
description: "When this digest was last seen by MySQL\n (-- api-linter: core::0142::time-field-names=disabled\n aip.dev/not-precedent: last_seen matches the MySQL performance_schema column name. --)"
format: date-time
sumTimerWait:
type: string
description: Cumulative total wait time in picoseconds (SUM_TIMER_WAIT from performance_schema)
minTimerWait:
type: string
description: Minimum single-execution wait time in picoseconds (MIN_TIMER_WAIT from performance_schema)
maxTimerWait:
type: string
description: Maximum single-execution wait time in picoseconds (MAX_TIMER_WAIT from performance_schema)
description: MySQLQueryStatsSnapshot represents a point-in-time snapshot of a MySQL query digest's cumulative stats
BatchCreateQueryStatsResponse:
type: object
properties: {}
description: Response from batch creating execution plans
GoogleProtobufAny:
type: object
properties:
'@type':
type: string
description: The type of the serialized message.
additionalProperties: true
description: Contains an arbitrary serialized message along with a @type that describes the type of the serialized message.
securitySchemes:
BearerAuth:
type: http
scheme: bearer
bearerFormat: JWT
ApiKeyAuth:
type: apiKey
in: header
name: X-API-Key
x-provenance:
method: searched
source: https://docs.cast.ai/reference
harvested: '2026-10-20'
tool: harvest-readme-openapi.py
note: Assembled verbatim from the OpenAPI definition ReadMe embeds in each operation page of the provider's developer portal; paths and components merged by API title, nothing authored.
assembled_from:
- https://docs.cast.ai/reference/advisorapi_batchgetadvisordatabasestats.md
- https://docs.cast.ai/reference/advisorapi_closeadvisorrecommendation.md
- https://docs.cast.ai/reference/advisorapi_getadvisorcachegroup.md
- https://docs.cast.ai/reference/advisorapi_getadvisordatabase.md
- https://docs.cast.ai/reference/advisorapi_getadvisordatabaseinstance.md
- https://docs.cast.ai/reference/advisorapi_getadvisorrecommendationdetail.md
- https://docs.cast.ai/reference/advisorapi_listadvisorcachegroups.md
- https://docs.cast.ai/reference/advisorapi_listadvisordatabaseinstances.md
- https://docs.cast.ai/reference/advisorapi_listadvisordatabases.md
- https://docs.cast.ai/reference/advisorapi_listadvisorrecommendations.md
- https://docs.cast.ai/reference/advisorapi_listtoprecommendations.md
- https://docs.cast.ai/reference/advisorapi_markadvisordbagentuninstalled.md
- https://docs.cast.ai/reference/advisorapi_reopenadvisorrecommendation.md
- https://docs.cast.ai/reference/advisorapi_resendadvisorvalidationrequest.md
- https://docs.cast.ai/reference/advisorapi_resetadvisorrecommendations.md
- https://docs.cast.ai/reference/cachegroupsapi_getindexadvisorcachegroup.md
- https://docs.cast.ai/reference/cachegroupsapi_listindexadvisorcachegroups.md
- https://docs.cast.ai/reference/cachegroupsapi_sendagentheartbeat.md
- https://docs.cast.ai/reference/cachingapi_createcacherule.md
- https://docs.cast.ai/reference/cachingapi_createproxy.md
- https://docs.cast.ai/reference/cachingapi_deletecacherule.md
- https://docs.cast.ai/reference/cachingapi_exchangeproxystate.md
- https://docs.cast.ai/reference/cachingapi_getinstanceproxycachemetrics.md
- https://docs.cast.ai/reference/cachingapi_getproxycachemetrics.md
- https://docs.cast.ai/reference/cachingapi_getproxycachequeryinsights.md
- https://docs.cast.ai/reference/cachingapi_getproxycachequerytemplate.md
- https://docs.cast.ai/reference/cachingapi_getproxycachesummary.md
- https://docs.cast.ai/reference/cachingapi_getproxyconnectionsmetrics.md
- https://docs.cast.ai/reference/cachingapi_getproxyperformancemetrics.md
- https://docs.cast.ai/reference/cachingapi_getproxyqueries.md
- https://docs.cast.ai/reference/cachingapi_listcacherules.md
- https://docs.cast.ai/reference/cachingapi_reportoperationalmetrics.md
- https://docs.cast.ai/reference/cachingapi_reportpoolingmetrics.md
- https://docs.cast.ai/reference/cachingapi_reportquerymetrics.md
- https://docs.cast.ai/reference/cachingapi_updatecacherule.md
- https://docs.cast.ai/reference/cachingapi_updateproxydatabase.md
- https://docs.cast.ai/reference/databaseinstanceconfigapi_reportdatabaseinstanceconfig.md
- https://docs.cast.ai/reference/databaseinstancesapi_createdatabase.md
- https://docs.cast.ai/reference/databaseinstancesapi_createdatabaseinstance.md
- https://docs.cast.ai/reference/databaseinstancesapi_deletedatabase.md
- https://docs.cast.ai/reference/databaseinstancesapi_deletedatabaseinstance.md
- https://docs.cast.ai/reference/databaseinstancesapi_getcloudsyncstatus.md
- https://docs.cast.ai/reference/databaseinstancesapi_getdatabase.md
- https://docs.cast.ai/reference/databaseinstancesapi_getdatabaseinstancecachingsummary.md
- https://docs.cast.ai/reference/databaseinstancesapi_getdatabaseinstancedetails.md
- https://docs.cast.ai/reference/databaseinstancesapi_getdatabaseinstancehealthmetrics.md
- https://docs.cast.ai/reference/databaseinstancesapi_getdatabaseinstancemetricsfilteroptions.md
- https://docs.cast.ai/reference/databaseinstancesapi_getdatabaseinstancescloudintegrationsummary.md
- https://docs.cast.ai/reference/databaseinstancesapi_listcachingpotentialdatabases.md
- https://docs.cast.ai/reference/databaseinstancesapi_listcloudoptimizationcandidates.md
- https://docs.cast.ai/reference/databaseinstancesapi_listconnectionpoolingcandidates.md
- https://docs.cast.ai/reference/databaseinstancesapi_listdatabaseinstancemembers.md
- https://docs.cast.ai/reference/databaseinstancesapi_listdatabaseinstances.md
- https://docs.cast.ai/reference/databaseinstancesapi_listtopqueryrecommendations.md
- https://docs.cast.ai/reference/databaseinstancesapi_updatedatabaseinstance.md
- https://docs.cast.ai/reference/databasesapi_getcachedatabase.md
- https://docs.cast.ai/reference/databasesapi_listcachedatabases.md
- https://docs.cast.ai/reference/dbagentapi_ingestagentheartbeat.md
- https://docs.cast.ai/reference/dbagentapi_ingestmysqlindexsnapshots.md
- https://docs.cast.ai/reference/dbagentapi_ingestmysqlquerystats.md
- https://docs.cast.ai/reference/dbagentapi_ingestmysqltablesmetadata.md
- https://docs.cast.ai/reference/dbagentapi_ingestpostgresindexsnapshots.md
- https://docs.cast.ai/reference/dbagentapi_ingestpostgresquerystats.md
- https://docs.cast.ai/reference/dbagentapi_ingestpostgrestablesmetadata.md
- https://docs.cast.ai/reference/indexrecommendationsapi_listindexrecommendations.md
- https://docs.cast.ai/reference/indexsnapshotsapi_batchcreateindexsnapshots.md
- https://docs.cast.ai/reference/indexsnapshotsapi_batchcreatemysqlindexsnapshots.md
- https://docs.cast.ai/reference/querystatsapi_batchcreatemysqlquerystats.md
- https://docs.cast.ai/reference/querystatsapi_batchcreatepgquerystats.md
- https://docs.cast.ai/reference/querystatsapi_batchcreatequerystats.md
- https://docs.cast.ai/reference/tablemetadataapi_batchcreatemysqltablesmetadata.md
- https://docs.cast.ai/reference/tablemetadataapi_batchcreatetablesmetadata.md
- https://docs.cast.ai/reference/telemetryapi_ingesttelemetryevents.md
- https://docs.cast.ai/reference/telemetryapi_listtelemetryevents.md
merge:
pages: 74
deduped: 412
conflicts_kept_first: 0