diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-05-04 18:00:34 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-05-04 18:00:34 +0000 |
commit | 3f619478f796eddbba6e39502fe941b285dd97b1 (patch) | |
tree | e2c7b5777f728320e5b5542b6213fd3591ba51e2 /mysql-test/include/expect_qep.inc | |
parent | Initial commit. (diff) | |
download | mariadb-3f619478f796eddbba6e39502fe941b285dd97b1.tar.xz mariadb-3f619478f796eddbba6e39502fe941b285dd97b1.zip |
Adding upstream version 1:10.11.6.upstream/1%10.11.6upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'mysql-test/include/expect_qep.inc')
-rw-r--r-- | mysql-test/include/expect_qep.inc | 47 |
1 files changed, 47 insertions, 0 deletions
diff --git a/mysql-test/include/expect_qep.inc b/mysql-test/include/expect_qep.inc new file mode 100644 index 00000000..f7ec6629 --- /dev/null +++ b/mysql-test/include/expect_qep.inc @@ -0,0 +1,47 @@ +# 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; +--disable_ps2_protocol +eval $query; +--enable_ps2_protocol + +let $best_cost= + query_get_value(SHOW STATUS LIKE 'Last_query_cost', Value, 1); + +--disable_warnings +let $best_reads= +`select sum(variable_value) + from information_schema.session_status + where VARIABLE_NAME like 'Handler_read%'`; +--enable_warnings + +#echo Expect, cost: $best_cost, Handler_reads: $best_reads; |