top_queries
Identifies the costliest SQL statements by total execution time from server statistics, returning calls, mean and max seconds, rows and users, with credentials and sensitive values masked.
Instructions
The statements that took the server most time, the costliest first, from its own statistics (pg_stat_statements, performance_schema, Query Store): the statement with its values replaced as the server writes them, calls, total, mean and max seconds, rows, user and database. 20 by default (limit, up to 100). Credentials and the values of sensitive columns are masked, long statements cut at 500 characters. PostgreSQL, MySQL, MariaDB and SQL Server; read-only. Says so when the statistics are not enabled (pg_stat_statements not installed) or the user may not read them.
Tool call template
Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {
"connection": "<connection>"
},
"name": "top_queries"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| limit | No | Entries returned at most: sessions for `server_activity` (50 by default, up to 200), statements for `top_queries` (20 by default, up to 100). | |
| connection | Yes | The connection's name, as `list_connections` shows it. |