1** Setup **
2
3SET @old_big_tables = @@SESSION.sql_big_tables;
4CREATE TABLE t1(a varchar(20), b varchar(20));
5INSERT INTO t1 VALUES('aa','bb');
6INSERT INTO t1 VALUES('aa','bb');
7INSERT INTO t1 VALUES('aa','bb');
8INSERT INTO t1 VALUES('aa','bb');
9INSERT INTO t1 VALUES('aa','bb');
10'#--------------------FN_DYNVARS_155_01-------------------------#'
11SET SESSION sql_big_tables = 1;
12SET @diskTableCount = 0;
13SET @tempTableCount = 0;
14select count(a), b from t1 group by b;
15count(a)	b
165	bb
17SET @diskTableCount = 1 - @diskTableCount;
18SET @tempTableCount = 1 - @tempTableCount;
19SELECT @diskTableCount;
20@diskTableCount
211
221 Expected
23SELECT @tempTableCount;
24@tempTableCount
251
261 Expected
27'#--------------------FN_DYNVARS_155_02-------------------------#'
28SET SESSION sql_big_tables = 0;
29SET @diskTableCount = 1;
30SET @tempTableCount = 1;
31SELECT * FROM (SELECT ta.b as a, tb.a as b FROM t1 as ta INNER JOIN t1 as tb ON ta.a = tb.a) sub;
32a	b
33bb	aa
34bb	aa
35bb	aa
36bb	aa
37bb	aa
38bb	aa
39bb	aa
40bb	aa
41bb	aa
42bb	aa
43bb	aa
44bb	aa
45bb	aa
46bb	aa
47bb	aa
48bb	aa
49bb	aa
50bb	aa
51bb	aa
52bb	aa
53bb	aa
54bb	aa
55bb	aa
56bb	aa
57bb	aa
58SET @diskTableCount = 1 - @diskTableCount;
59SET @tempTableCount = 2 - @tempTableCount;
60SELECT @diskTableCount;
61@diskTableCount
620
630 Expected
64SELECT @tempTableCount;
65@tempTableCount
661
671 Expected
68'#--------------------FN_DYNVARS_155_03-------------------------#'
69** Connecting con_int1 using root **
70** Connection con_int1 **
71SELECT @@SESSION.sql_big_tables;
72@@SESSION.sql_big_tables
730
740 / FALSE Expected;
75SET SESSION sql_big_tables = FALSE;
76** Connecting con_int2 using root **
77** Connection con_int2 **
78SELECT @@SESSION.sql_big_tables;
79@@SESSION.sql_big_tables
800
810 / FALSE Expected;
82SET SESSION sql_big_tables = TRUE;
83** Connection con_int1 **
84SELECT @@SESSION.sql_big_tables;
85@@SESSION.sql_big_tables
860
870 / FALSE Expected;
88** Connection con_int2 **
89SELECT @@SESSION.sql_big_tables;
90@@SESSION.sql_big_tables
911
921 / TRUE Expected;
93** Connection default **
94Disconnecting Connections con_int1, con_int2
95SET SESSION sql_big_tables = @old_big_tables;
96DROP TABLE t1;
97