File: eq_range_idx_stat.test

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 (101 lines) | stat: -rw-r--r-- 2,087 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
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
# Tests for eq_range_index_dive_limit variable: 
#   test that index dives are not done when index 
#   statistics is requested

--source include/have_debug.inc

SET eq_range_index_dive_limit=default;
SELECT @@eq_range_index_dive_limit;

CREATE TABLE t1
(
  /* Field names reflect value(rowid) distribution, st=STairs, swt= SaWTooth */
  st_a int,
  swt1a int,
  swt2a int,

  st_b int,
  swt1b int,
  swt2b int,

  key sta_swt12a(st_a,swt1a,swt2a),
  key sta_swt1a(st_a,swt1a),
  key sta_swt2a(st_a,swt2a),
  key sta_swt21a(st_a,swt2a,swt1a),

  key st_a(st_a),
  key stb_swt1a_2b(st_b,swt1b,swt2a),
  key stb_swt1b(st_b,swt1b),
  key st_b(st_b)
) ;

ALTER TABLE t1 DISABLE KEYS;

--disable_query_log
--echo #
--echo # Printing of many insert into t1 disabled.
--echo #
let $1=3;
while ($1)
{
  let $2=3;
  while ($2)
  {
    let $3=3;
    while ($3)
    {
      let $equal_records=30;
      while ($equal_records)
      {
        eval insert into t1 select $1, $2, $3, $1 ,$2, $3;
        dec $equal_records;
      }
      dec $3;
    }
    dec $2;
  }
 dec $1;
}
--enable_query_log
ALTER TABLE t1 ENABLE KEYS;
ANALYZE TABLE t1;

--echo #
--echo # Run index_merge queries two times: 1) with index dives
--echo #                                    2) with index statistics
--echo #
let $iterations=2;
while ($iterations)
{
  dec $iterations;

  --echo
  explain 
  select * from t1 
  where st_a=1 and swt1a=1 and swt2a=1 and st_b=1 and swt1b=1 and swt2b=1 limit 5;

  select * from t1 
  where st_a=1 and swt1a=1 and swt2a=1 and st_b=1 and swt1b=1 and swt2b=1 limit 5;

  --echo
  explain 
  select * from t1
  where st_a=1 and swt1a=1 and swt2a=1 and st_b=1 and swt1b=1 limit 5;

  select * from t1
  where st_a=1 and swt1a=1 and swt2a=1 and st_b=1 and swt1b=1 limit 5;

  --echo
  explain 
  select * from t1
  where st_a=1 and swt1a=1 and st_b=1 and swt1b=1 and swt1b=1 limit 5;

  select * from t1
  where st_a=1 and swt1a=1 and st_b=1 and swt1b=1 and swt1b=1 limit 5;

  --echo
  SET eq_range_index_dive_limit=1;
  SET SESSION DEBUG="+d,crash_records_in_range";
}

DROP TABLE t1;