MySQL 执行计划中代价估算的输出信息


来源: http://dev.mysql.com/worklog/task/?id=6510
EXPLAIN JSON should print cost for following:
*) "query_cost" - total cost of a query block, no matter top query or a subquery.
*) "sort_cost" - cost of the first sorting operation (GROUP BY or ORDER BY) where 
and if filesort is used. Cost for second sorting operation isn't printed as 
optimizer doesn't calculate it.
*) "read_cost" - cost of reading for each table used in the query block.
*) "eval_cost" - cost of condition evaluation for each table in the query block.
*) "prefix_cost" - cost of executing prefix join in the query block.  
//"prefix_cost",应该表示的是“之前连接的代价”,但是单表扫描,该变量有值存在,如下图,疑似bug。待查
//待查之后,验明正身:此值表示自身的cost,所以单表扫描,改变量有值是正确的。所以,如下句的解释说明了此含义:
/* "prefix_cost" cost of executing prefix join, i.e. cost of joining tables of the query block from the first one to the one (and including it) for which the value is given.
*/

*) "data_read_per_join" - estimated amount of data from the table processed during single query block execution. *) "rows_produced_per_join"/"rows_examined_per_scan" estimated number of records from the table (per each table from the query block) produced/examined per single query block execution. *) "used_columns" - list of columns of the table (per each table in the query block) used for either read or write in the query.

 另外,还有解释如下:
1) "query_cost" total [sub]query cost per one execution. Wrapped in the "cost_info" node, child of the "query_block" node. For the top-level select should be equal to the 'last_query_cost' status variable. 2) "sort_cost" cost of filesort, independently of algorithm. Wrapped in the "cost_info" node, child of the "ordering_operation" node. 3) "read_cost" cost of retrieving data from table, i.e access method cost. 4) "eval_cost" cost of condition evaluation. 5) "prefix_cost" cost of executing prefix join, i.e. cost of joining tables of the query block from the first one to the one (and including it) for which the value is given.

图片对应MySQL 5.7.
MySQL 执行计划中代价估算的输出信息 - 那海蓝蓝 - 那海蓝蓝的博客
 
 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值