~ubuntu-branches/ubuntu/karmic/mysql-dfsg-5.1/karmic

« back to all changes in this revision

Viewing changes to mysql-test/t/max_seeks_for_key_func.test

  • Committer: Bazaar Package Importer
  • Author(s): Mathias Gug
  • Date: 2009-06-25 12:55:45 UTC
  • mfrom: (0.2.1 upstream)
  • mto: This revision was merged to the branch mainline in revision 9.
  • Revision ID: james.westby@ubuntu.com-20090625125545-v27uqh8rlsj8uh2y
Tags: upstream-5.1.34
ImportĀ upstreamĀ versionĀ 5.1.34

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
 
2
 
 
3
 
 
4
 
#Test for max_seeks_for_key#
5
 
 
6
 
 
7
 
--disable_warnings
8
 
drop table if exists t1;
9
 
--enable_warnings
10
 
 
11
 
 
12
 
#########################
13
 
#   Creating new table  #
14
 
#########################
15
 
 
16
 
CREATE TABLE t1
17
 
(a int auto_increment primary key, 
18
 
b char(20)
19
 
);
20
 
 
21
 
 
22
 
 
23
 
--echo '#--------------------FN_DYNVARS_084_01-------------------------#'
24
 
##########################################################
25
 
#    Test behavior of variable on new connection # 01    #
26
 
##########################################################
27
 
 
28
 
CONNECT (test_con1,localhost,root,,);
29
 
CONNECTION test_con1;
30
 
 
31
 
# Value of session & global vairable here should be 10
32
 
SELECT @@global.max_seeks_for_key = 10;
33
 
SELECT @@session.max_seeks_for_key = 10;
34
 
 
35
 
# Setting global value of variable and inserting data in table
36
 
SET @@global.max_seeks_for_key = 20;
37
 
SELECT @@global.max_seeks_for_key;
38
 
INSERT into t1(b) values("AREc");
39
 
explain select STRAIGHT_JOIN * from t1,t1 as t2 where t1.b=t2.b;
40
 
 
41
 
# Setting session value of variable and inserting data in table
42
 
SET @@session.max_seeks_for_key = 2;
43
 
SELECT @@session.max_seeks_for_key;
44
 
INSERT into t1(b) values("BREc");
45
 
INSERT into t1(b) values("CRec");
46
 
explain select STRAIGHT_JOIN * from t1,t1 as t2 where t1.b=t2.b;
47
 
 
48
 
 
49
 
--echo '#--------------------FN_DYNVARS_084_02-------------------------#'
50
 
##########################################################
51
 
#    Test behavior of variable on new connection # 02    #
52
 
##########################################################
53
 
 
54
 
 
55
 
CONNECT (test_con2,localhost,root,,);
56
 
connection test_con2;
57
 
 
58
 
 
59
 
# Value of session & global vairable here should be 10
60
 
SELECT @@global.max_seeks_for_key = 10;
61
 
SELECT @@session.max_seeks_for_key = 10;
62
 
 
63
 
# Setting global value of variable and inserting data in table
64
 
SET @@global.max_seeks_for_key = 20;
65
 
SELECT @@global.max_seeks_for_key;
66
 
INSERT into t1(b) values("AREc");
67
 
explain select STRAIGHT_JOIN * from t1,t1 as t2 where t1.b=t2.b;
68
 
 
69
 
# Setting session value of variable and inserting data in table
70
 
SET @@session.max_seeks_for_key = 2;
71
 
SELECT @@session.max_seeks_for_key;
72
 
INSERT into t1(b) values("BREc");
73
 
INSERT into t1(b) values("CRec");
74
 
explain select STRAIGHT_JOIN * from t1,t1 as t2 where t1.b=t2.b;
75
 
 
76
 
 
77
 
 
78
 
 
79
 
 
80
 
 
81
 
#####################################################
82
 
#   Inserting values in  table t and analyzing table #
83
 
#####################################################
84
 
 
85
 
INSERT INTO t1 values(null,"test");
86
 
INSERT INTO t1 VALUES (null,"a"),(null,"a"),(null,"a"),
87
 
                     (null,"a"),(null,"a"),(null,"a"),(null,"a"),
88
 
                     (null,"a"),(null,"a"),(null,"a");
89
 
explain SELECT STRAIGHT_JOIN * from t1,t1 as t2 where t1.b=t2.b;
90
 
analyze table t1;
91
 
 
92
 
###################################################################
93
 
#   Setting new value for max_seeks_for_key and anaylyzing table  #
94
 
###################################################################
95
 
 
96
 
SET MAX_SEEKS_FOR_KEY=1;
97
 
 
98
 
 
99
 
explain select STRAIGHT_JOIN * from t1,t1 as t2 where t1.b=t2.b;
100
 
SET MAX_SEEKS_FOR_KEY=DEFAULT;
101
 
 
102
 
drop table t1;
103
 
 
104