当尝试查找复杂查询(其中包含子查询)的成本时,我得到的值为 0。 mysql's manual says :
"The Last_query_cost value can be computed accurately only for simple “flat” queries, not complex queries such as those with subqueries or UNION. For the latter, the value is set to 0."
我的问题是 - 如何计算复杂查询的成本?
最佳答案
我不想成为 h8r,但我不相信“Last_query_cost”的优点……它似乎过度简化了查询的实际成本。因缺乏教育而感到困惑。 :)
就我个人而言,我更关注 EXPLAIN 中列出的执行路径,以及 SHOW SESSION STATUS LIKE 'Handler_%' 值以查看实际执行的操作。
关于用于复杂查询的 MySQL last_query_cost,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4209238/