MySQL 5.6.14 Source Code Document
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
execute_with_statistics.inc
1 # include/execute_with_statistics.inc
2 #
3 # SUMMARY
4 #
5 # Explain and execute the select statment in $query.
6 # Then report 'Last_query_cost' estimate from the query
7 # optimizer and total number of 'Handler_read%' when the
8 # query was executed.
9 # Intended usage is to verify that there are not regressions
10 # in either calculated or actuall cost for $query.
11 #
12 # USAGE
13 #
14 # let $query= <select statement>;
15 # --source include/execute_with_statistics.inc
16 #
17 # EXAMPLE
18 # t/greedy_optimizer.test
19 #
20 
21 eval EXPLAIN $query;
22 SHOW STATUS LIKE 'Last_query_cost';
23 
24 FLUSH STATUS;
25 eval $query;
26 SELECT SUM(variable_value) AS Total_handler_reads
27  FROM information_schema.session_status
28  WHERE variable_name LIKE 'Handler_read%';