#At file:///home/andrei/MySQL/BZR/2a-23May/mysql-trunk/ based on revid:andrei.elkin@stripped
3703 Andrei Elkin 2011-02-22 [merge]
merging from the main repo prior to push own bug fixes
added:
mysql-test/include/check_qep.inc
mysql-test/include/expect_qep.inc
=== added file 'mysql-test/include/check_qep.inc'
--- a/mysql-test/include/check_qep.inc 1970-01-01 00:00:00 +0000
+++ b/mysql-test/include/check_qep.inc 2011-02-22 15:44:04 +0000
@@ -0,0 +1,50 @@
+# include/check_qep.inc
+#
+# SUMMARY
+#
+# Designed to be used together with include/check_qep.inc
+#
+# $query should be assigned a select statement using
+# straight_join to force the tables to be joined in most
+# optimal order.
+#
+# expect_qep.inc will then store the estimated 'Last_query_cost'
+# and total # 'Handler_read%' for this straight_joined query.
+#
+# We should then assign a non-straight_join'ed version of
+# the same query to $query and execute it using
+# 'include/check_qep.inc'. Its estimated cost and
+# #handler_reads will then be verified against the
+# previous straight_joined query.
+#
+# USAGE
+#
+# let $query= <select straight_join optimal statement>;
+# --source include/expect_qep.inc
+# let $query= <select statement>;
+# --source include/check_qep.inc
+#
+# EXAMPLE
+# t/greedy_optimizer.test
+#
+
+flush status;
+eval EXPLAIN $query;
+eval $query;
+
+let $cost=
+ query_get_value(SHOW STATUS LIKE 'Last_query_cost', Value, 1);
+
+let $reads=
+`select sum(variable_value)
+ from information_schema.session_status
+ where VARIABLE_NAME like 'Handler_read%'`;
+
+#echo Cost: $cost, Handler_reads: $reads;
+
+if ($cost != $best_cost)
+{ echo ### FAILED: Query_cost: $cost, expected: $best_cost ###;
+}
+if ($reads != $best_reads)
+{ echo ### FAILED: Handler_reads: $reads, expected: $best_reads ###;
+}
=== added file 'mysql-test/include/expect_qep.inc'
--- a/mysql-test/include/expect_qep.inc 1970-01-01 00:00:00 +0000
+++ b/mysql-test/include/expect_qep.inc 2011-02-22 15:44:04 +0000
@@ -0,0 +1,44 @@
+# include/expect_qep.inc
+#
+# SUMMARY
+#
+# Designed to be used together with include/check_qep.inc
+#
+# $query should be assigned a select statement using
+# straight_join to force the tables to be joined in most
+# optimal order.
+#
+# expect_qep.inc will then store the estimated 'Last_query_cost'
+# and total # 'Handler_read%' for this straight_joined query.
+#
+# We should then assign a non-straight_join'ed version of
+# the same query to $query and execute it using
+# 'include/check_qep.inc'. Its estimated cost and
+# #handler_reads will then be verified against the
+# previous straight_joined query.
+#
+# USAGE
+#
+# let $query= <select straight_join optimal statement>;
+# --source include/expect_qep.inc
+# let $query= <select statement>;
+# --source include/check_qep.inc
+#
+# EXAMPLE
+# t/greedy_optimizer.test
+#
+
+flush status;
+eval EXPLAIN $query;
+eval $query;
+
+let $best_cost=
+ query_get_value(SHOW STATUS LIKE 'Last_query_cost', Value, 1);
+
+let $best_reads=
+`select sum(variable_value)
+ from information_schema.session_status
+ where VARIABLE_NAME like 'Handler_read%'`;
+
+#echo Expect, cost: $best_cost, Handler_reads: $best_reads;
+
Attachment: [text/bzr-bundle] bzr/andrei.elkin@oracle.com-20110222155247-k07c3725arfph223.bundle
| Thread |
|---|
| • bzr commit into mysql-trunk branch (andrei.elkin:3703) | Andrei Elkin | 22 Feb |