List Database Query Statistics
list_db_query_statsRetrieve database query statistics from Mackerel to analyze slow or high-frequency queries and investigate performance issues.
Instructions
Retrieve database query statistics from Mackerel.
š USE THIS TOOL WHEN USERS:
Analyze slow database queries
Identify high-frequency queries
Investigate database performance issues
Monitor query execution patterns
Filter by environment and version
list_db_query_stats(
serviceName="my-service",
from=1700000000,
to=1700001800,
environment="production",
version="v1.2.3"
)Search for specific queries
list_db_query_stats(
serviceName="my-service",
from=1700000000,
to=1700001800,
query="SELECT * FROM users"
)Pagination
list_db_query_stats(
serviceName="my-service",
from=1700000000,
to=1700001800,
page=10,
perPage=50
)Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| to | Yes | End time for retrieving statistics (Unix epoch seconds). The range between `from` is limited to 30 minutes | |
| from | Yes | Start time for retrieving statistics (Unix epoch seconds). The range between `to` is limited to 30 minutes | |
| page | No | Page number (starting from 1). Default is 1 | |
| query | No | Filter by SQL query (partial match). Corresponds to `db.query.text` or `db.statement` in OpenTelemetry semantic conventions. db.query.text is preferred | |
| perPage | No | Number of items per page (1-100). Default is 20 | |
| version | No | Version. Corresponds to `service.version` in OpenTelemetry semantic conventions | |
| environment | No | Environment name. Corresponds to `deployment.environment` or `deployment.environment.name` in OpenTelemetry semantic conventions | |
| orderColumn | No | Sort column. One of `SUM` (total latency), `AVERAGE` (average latency), `P95` (95th percentile latency), or `EXECUTION_COUNT` (execution count). Default is `P95`. | |
| serviceName | Yes | Service name. Corresponds to `service.name` in OpenTelemetry semantic conventions. | |
| orderDirection | No | Sort order. Either `ASC` (ascending) or `DESC` (descending). Default is `DESC` | |
| serviceNamespace | No | Service namespace. Corresponds to `service.namespace` in OpenTelemetry semantic conventions |