You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: mysql-test/r/with_recursive.result
+22-14Lines changed: 22 additions & 14 deletions
Original file line number
Diff line number
Diff line change
@@ -905,6 +905,10 @@ insert into t1 values
905
905
# Shuffle rows to make sure the algorithm works
906
906
# with any read order of rows above
907
907
create table t2 select * from t1 order by rand();
908
+
# Tree-walking query. We turn off the Query Cache: indeed
909
+
# sometimes pb2 enables Query Cache and as we run twice the
910
+
# same query the 2nd may not actually be executed so the value
911
+
# of Created_tmp_tables displayed at end becomes "one less").
908
912
# Note that without ORDER BY, order of rows would be random as BNL
909
913
# implies that the randomized t2 is the driving table in the
910
914
# joining of rows.
@@ -918,7 +922,7 @@ union all
918
922
select t2.*, concat(tree_of_a.path,",",t2.id) from t2 join tree_of_a on
919
923
t2.id=tree_of_a.rightpar
920
924
)
921
-
select * from tree_of_a order by path;
925
+
select sql_no_cache * from tree_of_a order by path;
922
926
id select_type table partitions type possible_keys key key_len ref rows filtered Extra
923
927
1 PRIMARY <derived2> NULL ALL NULL NULL NULL NULL # 100.00 Using filesort
924
928
2 DERIVED t2 NULL ALL NULL NULL NULL NULL # 10.00 Using where
@@ -927,7 +931,7 @@ id select_type table partitions type possible_keys key key_len ref rows filtered
927
931
5 UNION tree_of_a NULL ALL NULL NULL NULL NULL # 100.00 Recursive
928
932
5 UNION t2 NULL ALL NULL NULL NULL NULL # 10.00 Using where; Using join buffer (Block Nested Loop)
929
933
Warnings:
930
-
Note 1003 with recursive `tree_of_a` as (/* select#2 */ select `test`.`t2`.`id` AS `id`,`test`.`t2`.`name` AS `name`,`test`.`t2`.`leftpar` AS `leftpar`,`test`.`t2`.`rightpar` AS `rightpar`,cast(`test`.`t2`.`id` as char(200) charset latin1) AS `path` from `test`.`t2` where (`test`.`t2`.`name` = 'A') union all /* select#3 */ select `test`.`t2`.`id` AS `id`,`test`.`t2`.`name` AS `name`,`test`.`t2`.`leftpar` AS `leftpar`,`test`.`t2`.`rightpar` AS `rightpar`,concat(`tree_of_a`.`path`,',',`test`.`t2`.`id`) AS `concat(tree_of_a.path,",",t2.id)` from `test`.`t2` join `tree_of_a` where (`test`.`t2`.`id` = `tree_of_a`.`leftpar`) union all /* select#5 */ select `test`.`t2`.`id` AS `id`,`test`.`t2`.`name` AS `name`,`test`.`t2`.`leftpar` AS `leftpar`,`test`.`t2`.`rightpar` AS `rightpar`,concat(`tree_of_a`.`path`,',',`test`.`t2`.`id`) AS `concat(tree_of_a.path,",",t2.id)` from `test`.`t2` join `tree_of_a` where (`test`.`t2`.`id` = `tree_of_a`.`rightpar`)) /* select#1 */ select `tree_of_a`.`id` AS `id`,`tree_of_a`.`name` AS `name`,`tree_of_a`.`leftpar` AS `leftpar`,`tree_of_a`.`rightpar` AS `rightpar`,`tree_of_a`.`path` AS `path` from `tree_of_a` order by `tree_of_a`.`path`
934
+
Note 1003 with recursive `tree_of_a` as (/* select#2 */ select `test`.`t2`.`id` AS `id`,`test`.`t2`.`name` AS `name`,`test`.`t2`.`leftpar` AS `leftpar`,`test`.`t2`.`rightpar` AS `rightpar`,cast(`test`.`t2`.`id` as char(200) charset latin1) AS `path` from `test`.`t2` where (`test`.`t2`.`name` = 'A') union all /* select#3 */ select `test`.`t2`.`id` AS `id`,`test`.`t2`.`name` AS `name`,`test`.`t2`.`leftpar` AS `leftpar`,`test`.`t2`.`rightpar` AS `rightpar`,concat(`tree_of_a`.`path`,',',`test`.`t2`.`id`) AS `concat(tree_of_a.path,",",t2.id)` from `test`.`t2` join `tree_of_a` where (`test`.`t2`.`id` = `tree_of_a`.`leftpar`) union all /* select#5 */ select `test`.`t2`.`id` AS `id`,`test`.`t2`.`name` AS `name`,`test`.`t2`.`leftpar` AS `leftpar`,`test`.`t2`.`rightpar` AS `rightpar`,concat(`tree_of_a`.`path`,',',`test`.`t2`.`id`) AS `concat(tree_of_a.path,",",t2.id)` from `test`.`t2` join `tree_of_a` where (`test`.`t2`.`id` = `tree_of_a`.`rightpar`)) /* select#1 */ select sql_no_cache `tree_of_a`.`id` AS `id`,`tree_of_a`.`name` AS `name`,`tree_of_a`.`leftpar` AS `leftpar`,`tree_of_a`.`rightpar` AS `rightpar`,`tree_of_a`.`path` AS `path` from `tree_of_a` order by `tree_of_a`.`path`
931
935
with recursive tree_of_a as
932
936
(
933
937
select *, cast(id as char(200)) as path from t2 where name="A"
@@ -938,7 +942,7 @@ union all
938
942
select t2.*, concat(tree_of_a.path,",",t2.id) from t2 join tree_of_a on
939
943
t2.id=tree_of_a.rightpar
940
944
)
941
-
select * from tree_of_a order by path;
945
+
select sql_no_cache * from tree_of_a order by path;
942
946
id name leftpar rightpar path
943
947
1 A 2 3 1
944
948
2 LA 4 5 1,2
@@ -965,7 +969,7 @@ union all
965
969
select t2.*, concat(tree_of_a.path,",",t2.id) from t2 join tree_of_a on
966
970
t2.id=tree_of_a.rightpar
967
971
)
968
-
select * from tree_of_a order by path;
972
+
select sql_no_cache * from tree_of_a order by path;
969
973
id select_type table partitions type possible_keys key key_len ref rows filtered Extra
970
974
1 PRIMARY <derived2> NULL ALL NULL NULL NULL NULL # 100.00 Using filesort
971
975
2 DERIVED t2 NULL ALL NULL NULL NULL NULL # 10.00 Using where
@@ -974,7 +978,7 @@ id select_type table partitions type possible_keys key key_len ref rows filtered
974
978
5 UNION tree_of_a NULL ALL NULL NULL NULL NULL # 100.00 Recursive
975
979
5 UNION t2 NULL ALL NULL NULL NULL NULL # 10.00 Using where
976
980
Warnings:
977
-
Note 1003 with recursive `tree_of_a` as (/* select#2 */ select `test`.`t2`.`id` AS `id`,`test`.`t2`.`name` AS `name`,`test`.`t2`.`leftpar` AS `leftpar`,`test`.`t2`.`rightpar` AS `rightpar`,cast(`test`.`t2`.`id` as char(200) charset latin1) AS `path` from `test`.`t2` where (`test`.`t2`.`name` = 'A') union all /* select#3 */ select `test`.`t2`.`id` AS `id`,`test`.`t2`.`name` AS `name`,`test`.`t2`.`leftpar` AS `leftpar`,`test`.`t2`.`rightpar` AS `rightpar`,concat(`tree_of_a`.`path`,',',`test`.`t2`.`id`) AS `concat(tree_of_a.path,",",t2.id)` from `test`.`t2` join `tree_of_a` where (`test`.`t2`.`id` = `tree_of_a`.`leftpar`) union all /* select#5 */ select `test`.`t2`.`id` AS `id`,`test`.`t2`.`name` AS `name`,`test`.`t2`.`leftpar` AS `leftpar`,`test`.`t2`.`rightpar` AS `rightpar`,concat(`tree_of_a`.`path`,',',`test`.`t2`.`id`) AS `concat(tree_of_a.path,",",t2.id)` from `test`.`t2` join `tree_of_a` where (`test`.`t2`.`id` = `tree_of_a`.`rightpar`)) /* select#1 */ select `tree_of_a`.`id` AS `id`,`tree_of_a`.`name` AS `name`,`tree_of_a`.`leftpar` AS `leftpar`,`tree_of_a`.`rightpar` AS `rightpar`,`tree_of_a`.`path` AS `path` from `tree_of_a` order by `tree_of_a`.`path`
981
+
Note 1003 with recursive `tree_of_a` as (/* select#2 */ select `test`.`t2`.`id` AS `id`,`test`.`t2`.`name` AS `name`,`test`.`t2`.`leftpar` AS `leftpar`,`test`.`t2`.`rightpar` AS `rightpar`,cast(`test`.`t2`.`id` as char(200) charset latin1) AS `path` from `test`.`t2` where (`test`.`t2`.`name` = 'A') union all /* select#3 */ select `test`.`t2`.`id` AS `id`,`test`.`t2`.`name` AS `name`,`test`.`t2`.`leftpar` AS `leftpar`,`test`.`t2`.`rightpar` AS `rightpar`,concat(`tree_of_a`.`path`,',',`test`.`t2`.`id`) AS `concat(tree_of_a.path,",",t2.id)` from `test`.`t2` join `tree_of_a` where (`test`.`t2`.`id` = `tree_of_a`.`leftpar`) union all /* select#5 */ select `test`.`t2`.`id` AS `id`,`test`.`t2`.`name` AS `name`,`test`.`t2`.`leftpar` AS `leftpar`,`test`.`t2`.`rightpar` AS `rightpar`,concat(`tree_of_a`.`path`,',',`test`.`t2`.`id`) AS `concat(tree_of_a.path,",",t2.id)` from `test`.`t2` join `tree_of_a` where (`test`.`t2`.`id` = `tree_of_a`.`rightpar`)) /* select#1 */ select sql_no_cache `tree_of_a`.`id` AS `id`,`tree_of_a`.`name` AS `name`,`tree_of_a`.`leftpar` AS `leftpar`,`tree_of_a`.`rightpar` AS `rightpar`,`tree_of_a`.`path` AS `path` from `tree_of_a` order by `tree_of_a`.`path`
978
982
with recursive tree_of_a as
979
983
(
980
984
select *, cast(id as char(200)) as path from t2 where name="A"
@@ -985,7 +989,7 @@ union all
985
989
select t2.*, concat(tree_of_a.path,",",t2.id) from t2 join tree_of_a on
986
990
t2.id=tree_of_a.rightpar
987
991
)
988
-
select * from tree_of_a order by path;
992
+
select sql_no_cache * from tree_of_a order by path;
989
993
id name leftpar rightpar path
990
994
1 A 2 3 1
991
995
2 LA 4 5 1,2
@@ -1013,7 +1017,7 @@ union all
1013
1017
select t2.*, concat(tree_of_a.path,",",t2.id) from t2 join tree_of_a on
1014
1018
t2.id=tree_of_a.rightpar
1015
1019
)
1016
-
select * from tree_of_a;
1020
+
select sql_no_cache * from tree_of_a;
1017
1021
id name leftpar rightpar path
1018
1022
1 A 2 3 1
1019
1023
2 LA 4 5 1,2
@@ -2156,6 +2160,10 @@ insert into t1 values
2156
2160
# Shuffle rows to make sure the algorithm works
2157
2161
# with any read order of rows above
2158
2162
create table t2 select * from t1 order by rand();
2163
+
# Tree-walking query. We turn off the Query Cache: indeed
2164
+
# sometimes pb2 enables Query Cache and as we run twice the
2165
+
# same query the 2nd may not actually be executed so the value
2166
+
# of Created_tmp_tables displayed at end becomes "one less").
2159
2167
# Note that without ORDER BY, order of rows would be random as BNL
2160
2168
# implies that the randomized t2 is the driving table in the
2161
2169
# joining of rows.
@@ -2169,7 +2177,7 @@ union all
2169
2177
select t2.*, concat(tree_of_a.path,",",t2.id) from t2 join tree_of_a on
2170
2178
t2.id=tree_of_a.rightpar
2171
2179
)
2172
-
select * from tree_of_a order by path;
2180
+
select sql_no_cache * from tree_of_a order by path;
2173
2181
id select_type table partitions type possible_keys key key_len ref rows filtered Extra
2174
2182
1 PRIMARY <derived2> NULL ALL NULL NULL NULL NULL # 100.00 Using filesort
2175
2183
2 DERIVED t2 NULL ALL NULL NULL NULL NULL # 10.00 Using where
@@ -2178,7 +2186,7 @@ id select_type table partitions type possible_keys key key_len ref rows filtered
2178
2186
5 UNION tree_of_a NULL ALL NULL NULL NULL NULL # 100.00 Recursive
2179
2187
5 UNION t2 NULL ALL NULL NULL NULL NULL # 10.00 Using where; Using join buffer (Block Nested Loop)
2180
2188
Warnings:
2181
-
Note 1003 with recursive `tree_of_a` as (/* select#2 */ select `test`.`t2`.`id` AS `id`,`test`.`t2`.`name` AS `name`,`test`.`t2`.`leftpar` AS `leftpar`,`test`.`t2`.`rightpar` AS `rightpar`,cast(`test`.`t2`.`id` as char(200) charset latin1) AS `path` from `test`.`t2` where (`test`.`t2`.`name` = 'A') union all /* select#3 */ select `test`.`t2`.`id` AS `id`,`test`.`t2`.`name` AS `name`,`test`.`t2`.`leftpar` AS `leftpar`,`test`.`t2`.`rightpar` AS `rightpar`,concat(`tree_of_a`.`path`,',',`test`.`t2`.`id`) AS `concat(tree_of_a.path,",",t2.id)` from `test`.`t2` join `tree_of_a` where (`test`.`t2`.`id` = `tree_of_a`.`leftpar`) union all /* select#5 */ select `test`.`t2`.`id` AS `id`,`test`.`t2`.`name` AS `name`,`test`.`t2`.`leftpar` AS `leftpar`,`test`.`t2`.`rightpar` AS `rightpar`,concat(`tree_of_a`.`path`,',',`test`.`t2`.`id`) AS `concat(tree_of_a.path,",",t2.id)` from `test`.`t2` join `tree_of_a` where (`test`.`t2`.`id` = `tree_of_a`.`rightpar`)) /* select#1 */ select `tree_of_a`.`id` AS `id`,`tree_of_a`.`name` AS `name`,`tree_of_a`.`leftpar` AS `leftpar`,`tree_of_a`.`rightpar` AS `rightpar`,`tree_of_a`.`path` AS `path` from `tree_of_a` order by `tree_of_a`.`path`
2189
+
Note 1003 with recursive `tree_of_a` as (/* select#2 */ select `test`.`t2`.`id` AS `id`,`test`.`t2`.`name` AS `name`,`test`.`t2`.`leftpar` AS `leftpar`,`test`.`t2`.`rightpar` AS `rightpar`,cast(`test`.`t2`.`id` as char(200) charset latin1) AS `path` from `test`.`t2` where (`test`.`t2`.`name` = 'A') union all /* select#3 */ select `test`.`t2`.`id` AS `id`,`test`.`t2`.`name` AS `name`,`test`.`t2`.`leftpar` AS `leftpar`,`test`.`t2`.`rightpar` AS `rightpar`,concat(`tree_of_a`.`path`,',',`test`.`t2`.`id`) AS `concat(tree_of_a.path,",",t2.id)` from `test`.`t2` join `tree_of_a` where (`test`.`t2`.`id` = `tree_of_a`.`leftpar`) union all /* select#5 */ select `test`.`t2`.`id` AS `id`,`test`.`t2`.`name` AS `name`,`test`.`t2`.`leftpar` AS `leftpar`,`test`.`t2`.`rightpar` AS `rightpar`,concat(`tree_of_a`.`path`,',',`test`.`t2`.`id`) AS `concat(tree_of_a.path,",",t2.id)` from `test`.`t2` join `tree_of_a` where (`test`.`t2`.`id` = `tree_of_a`.`rightpar`)) /* select#1 */ select sql_no_cache `tree_of_a`.`id` AS `id`,`tree_of_a`.`name` AS `name`,`tree_of_a`.`leftpar` AS `leftpar`,`tree_of_a`.`rightpar` AS `rightpar`,`tree_of_a`.`path` AS `path` from `tree_of_a` order by `tree_of_a`.`path`
2182
2190
with recursive tree_of_a as
2183
2191
(
2184
2192
select *, cast(id as char(200)) as path from t2 where name="A"
@@ -2189,7 +2197,7 @@ union all
2189
2197
select t2.*, concat(tree_of_a.path,",",t2.id) from t2 join tree_of_a on
2190
2198
t2.id=tree_of_a.rightpar
2191
2199
)
2192
-
select * from tree_of_a order by path;
2200
+
select sql_no_cache * from tree_of_a order by path;
2193
2201
id name leftpar rightpar path
2194
2202
1 A 2 3 1
2195
2203
2 LA 4 5 1,2
@@ -2216,7 +2224,7 @@ union all
2216
2224
select t2.*, concat(tree_of_a.path,",",t2.id) from t2 join tree_of_a on
2217
2225
t2.id=tree_of_a.rightpar
2218
2226
)
2219
-
select * from tree_of_a order by path;
2227
+
select sql_no_cache * from tree_of_a order by path;
2220
2228
id select_type table partitions type possible_keys key key_len ref rows filtered Extra
2221
2229
1 PRIMARY <derived2> NULL ALL NULL NULL NULL NULL # 100.00 Using filesort
2222
2230
2 DERIVED t2 NULL ALL NULL NULL NULL NULL # 10.00 Using where
@@ -2225,7 +2233,7 @@ id select_type table partitions type possible_keys key key_len ref rows filtered
2225
2233
5 UNION tree_of_a NULL ALL NULL NULL NULL NULL # 100.00 Recursive
2226
2234
5 UNION t2 NULL ALL NULL NULL NULL NULL # 10.00 Using where
2227
2235
Warnings:
2228
-
Note 1003 with recursive `tree_of_a` as (/* select#2 */ select `test`.`t2`.`id` AS `id`,`test`.`t2`.`name` AS `name`,`test`.`t2`.`leftpar` AS `leftpar`,`test`.`t2`.`rightpar` AS `rightpar`,cast(`test`.`t2`.`id` as char(200) charset latin1) AS `path` from `test`.`t2` where (`test`.`t2`.`name` = 'A') union all /* select#3 */ select `test`.`t2`.`id` AS `id`,`test`.`t2`.`name` AS `name`,`test`.`t2`.`leftpar` AS `leftpar`,`test`.`t2`.`rightpar` AS `rightpar`,concat(`tree_of_a`.`path`,',',`test`.`t2`.`id`) AS `concat(tree_of_a.path,",",t2.id)` from `test`.`t2` join `tree_of_a` where (`test`.`t2`.`id` = `tree_of_a`.`leftpar`) union all /* select#5 */ select `test`.`t2`.`id` AS `id`,`test`.`t2`.`name` AS `name`,`test`.`t2`.`leftpar` AS `leftpar`,`test`.`t2`.`rightpar` AS `rightpar`,concat(`tree_of_a`.`path`,',',`test`.`t2`.`id`) AS `concat(tree_of_a.path,",",t2.id)` from `test`.`t2` join `tree_of_a` where (`test`.`t2`.`id` = `tree_of_a`.`rightpar`)) /* select#1 */ select `tree_of_a`.`id` AS `id`,`tree_of_a`.`name` AS `name`,`tree_of_a`.`leftpar` AS `leftpar`,`tree_of_a`.`rightpar` AS `rightpar`,`tree_of_a`.`path` AS `path` from `tree_of_a` order by `tree_of_a`.`path`
2236
+
Note 1003 with recursive `tree_of_a` as (/* select#2 */ select `test`.`t2`.`id` AS `id`,`test`.`t2`.`name` AS `name`,`test`.`t2`.`leftpar` AS `leftpar`,`test`.`t2`.`rightpar` AS `rightpar`,cast(`test`.`t2`.`id` as char(200) charset latin1) AS `path` from `test`.`t2` where (`test`.`t2`.`name` = 'A') union all /* select#3 */ select `test`.`t2`.`id` AS `id`,`test`.`t2`.`name` AS `name`,`test`.`t2`.`leftpar` AS `leftpar`,`test`.`t2`.`rightpar` AS `rightpar`,concat(`tree_of_a`.`path`,',',`test`.`t2`.`id`) AS `concat(tree_of_a.path,",",t2.id)` from `test`.`t2` join `tree_of_a` where (`test`.`t2`.`id` = `tree_of_a`.`leftpar`) union all /* select#5 */ select `test`.`t2`.`id` AS `id`,`test`.`t2`.`name` AS `name`,`test`.`t2`.`leftpar` AS `leftpar`,`test`.`t2`.`rightpar` AS `rightpar`,concat(`tree_of_a`.`path`,',',`test`.`t2`.`id`) AS `concat(tree_of_a.path,",",t2.id)` from `test`.`t2` join `tree_of_a` where (`test`.`t2`.`id` = `tree_of_a`.`rightpar`)) /* select#1 */ select sql_no_cache `tree_of_a`.`id` AS `id`,`tree_of_a`.`name` AS `name`,`tree_of_a`.`leftpar` AS `leftpar`,`tree_of_a`.`rightpar` AS `rightpar`,`tree_of_a`.`path` AS `path` from `tree_of_a` order by `tree_of_a`.`path`
2229
2237
with recursive tree_of_a as
2230
2238
(
2231
2239
select *, cast(id as char(200)) as path from t2 where name="A"
@@ -2236,7 +2244,7 @@ union all
2236
2244
select t2.*, concat(tree_of_a.path,",",t2.id) from t2 join tree_of_a on
2237
2245
t2.id=tree_of_a.rightpar
2238
2246
)
2239
-
select * from tree_of_a order by path;
2247
+
select sql_no_cache * from tree_of_a order by path;
2240
2248
id name leftpar rightpar path
2241
2249
1 A 2 3 1
2242
2250
2 LA 4 5 1,2
@@ -2264,7 +2272,7 @@ union all
2264
2272
select t2.*, concat(tree_of_a.path,",",t2.id) from t2 join tree_of_a on
0 commit comments