slow_query
Last updated
Was this helpful?
Last updated
Was this helpful?
Slow queries logs are written to tidb-slow.log
(set with slow-query-file
in the config) if they are over the slow-threshold
(300ms by default). If record-plan-in-slow-log
is enabled this will include the execution plan. This uses .
Each TiDB node writes its own slow logs.
The slow log can be viewed directly or via the information_schema.SLOW_QUERY
table.
There is also the information_schema.CLUSTER_SLOW_QUERY
table that combines the slow log from all nodes into a single table.
CLUSTER_SLOW_QUERY
is using the coprocessor
gRPC interface to send cop requests to the TiDB node. This allows the reuse of query condition push down and column prune, to reduce unnecessary data transfer.
User docs
The column definition is in .
The helps to extract some predicates of slow_query
.
A lot of the other logic can be found in .
This table has , which adds stats to EXPLAIN ANALYZE
output.
The uses the CLUSTER_SLOW_QUERY
table to display the slow queries in a webpage.
There are no RuntimeStats
for this table, see for a request to add that.