File: expect_qep.inc

package info (click to toggle)
percona-xtrabackup 2.2.3-2.1
  • links: PTS
  • area: main
  • in suites: jessie, jessie-kfreebsd
  • size: 293,260 kB
  • ctags: 146,881
  • sloc: cpp: 1,051,960; ansic: 570,217; java: 54,595; perl: 53,495; pascal: 44,194; sh: 27,826; yacc: 15,314; python: 12,142; xml: 7,848; sql: 4,125; makefile: 1,459; awk: 785; lex: 758
file content (44 lines) | stat: -rw-r--r-- 1,185 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
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;