MySQL last_query_cost for complex queries
when try开发者_运维百科ing to find the cost of a complex query (one with a sub-query in it) i get a value of 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."
and my question is - how do i calculate a cost of a complex query?
I don't mean to be a h8r, but I'm not convinced in the merit of the 'Last_query_cost'... it just seems to over simplify what the cost of a query really is. Obfuscation for a lack of education. :)
Personally, I pay more attention to the execution path laid out in the EXPLAIN, and the SHOW SESSION STATUS LIKE 'Handler_%' values to see what is actually done.
精彩评论