You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

123 lines
6.7 KiB

  1. --- r/subselect_extra.result 2012-01-09 16:13:21.000000000 +0100
  2. +++ r/subselect_extra.reject 2012-02-10 16:19:24.000000000 +0100
  3. @@ -43,10 +43,11 @@
  4. select * from t1
  5. where id in (select id from t1 as x1 where (t1.cur_date is null));
  6. id select_type table type possible_keys key key_len ref rows filtered Extra
  7. -1 PRIMARY NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables
  8. +1 PRIMARY t1 ALL NULL NULL NULL NULL 1 100.00 Using where
  9. +1 PRIMARY x1 ALL NULL NULL NULL NULL 1 100.00 Using where; FirstMatch(t1); Using join buffer (flat, BNL join)
  10. Warnings:
  11. Note 1276 Field or reference 'test.t1.cur_date' of SELECT #2 was resolved in SELECT #1
  12. -Note 1003 select 1 AS `id`,'2007-04-25 18:30:22' AS `cur_date` from (dual) where (('2007-04-25 18:30:22' = 0))
  13. +Note 1003 select `test`.`t1`.`id` AS `id`,`test`.`t1`.`cur_date` AS `cur_date` from `test`.`t1` semi join (`test`.`t1` `x1`) where ((`test`.`x1`.`id` = `test`.`t1`.`id`) and (`test`.`t1`.`cur_date` = 0))
  14. select * from t1
  15. where id in (select id from t1 as x1 where (t1.cur_date is null));
  16. id cur_date
  17. @@ -54,10 +55,11 @@
  18. select * from t2
  19. where id in (select id from t2 as x1 where (t2.cur_date is null));
  20. id select_type table type possible_keys key key_len ref rows filtered Extra
  21. -1 PRIMARY NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables
  22. +1 PRIMARY t2 ALL NULL NULL NULL NULL 1 100.00 Using where
  23. +1 PRIMARY x1 ALL NULL NULL NULL NULL 1 100.00 Using where; FirstMatch(t2); Using join buffer (flat, BNL join)
  24. Warnings:
  25. Note 1276 Field or reference 'test.t2.cur_date' of SELECT #2 was resolved in SELECT #1
  26. -Note 1003 select 1 AS `id`,'2007-04-25' AS `cur_date` from (dual) where (('2007-04-25' = 0))
  27. +Note 1003 select `test`.`t2`.`id` AS `id`,`test`.`t2`.`cur_date` AS `cur_date` from `test`.`t2` semi join (`test`.`t2` `x1`) where ((`test`.`x1`.`id` = `test`.`t2`.`id`) and (`test`.`t2`.`cur_date` = 0))
  28. select * from t2
  29. where id in (select id from t2 as x1 where (t2.cur_date is null));
  30. id cur_date
  31. @@ -132,7 +134,7 @@
  32. create index idx_t1_2 on t1 (a1,a2,b);
  33. analyze table t1;
  34. Table Op Msg_type Msg_text
  35. -test.t1 analyze status Table is already up to date
  36. +test.t1 analyze status OK
  37. create table t2 (
  38. a1 char(64), a2 char(64) not null, b char(16), c char(16), d char(16), dummy char(64) default ' '
  39. );
  40. @@ -159,7 +161,7 @@
  41. create index idx_t2_2 on t2 (a1,a2,b);
  42. analyze table t2;
  43. Table Op Msg_type Msg_text
  44. -test.t2 analyze status Table is already up to date
  45. +test.t2 analyze status OK
  46. create table t3 (
  47. a1 char(1), a2 char(1), b char(1), c char(4) not null, d char(3), dummy char(1) default ' '
  48. );
  49. @@ -220,14 +222,14 @@
  50. create index idx_t3_2 on t3 (a1,a2,b);
  51. analyze table t3;
  52. Table Op Msg_type Msg_text
  53. -test.t3 analyze status Table is already up to date
  54. +test.t3 analyze status OK
  55. explain select a1,a2,b,c,min(c), max(c) from t1
  56. where exists ( select * from t2
  57. where t2.c in (select c from t3 where t3.c > t1.b) and
  58. t2.c > 'b1' )
  59. group by a1,a2,b;
  60. id select_type table type possible_keys key key_len ref rows Extra
  61. -1 PRIMARY t1 range NULL idx_t1_1 147 NULL 17 Using where; Using index for group-by
  62. +1 PRIMARY t1 range NULL idx_t1_1 147 NULL 129 Using where; Using index for group-by
  63. 2 DEPENDENT SUBQUERY t2 index NULL idx_t2_1 163 NULL 164 Using where; Using index
  64. 2 DEPENDENT SUBQUERY t3 index NULL idx_t3_1 10 NULL 192 Using where; Using index; FirstMatch(t2); Using join buffer (flat, BNL join)
  65. select a1,a2,b,c,min(c), max(c) from t1
  66. @@ -345,11 +347,12 @@
  67. SELECT * FROM t2 RIGHT JOIN (SELECT * FROM t1) AS t ON t.a != 0
  68. WHERE t.a IN (SELECT b FROM t1);
  69. id select_type table type possible_keys key key_len ref rows filtered Extra
  70. -1 PRIMARY t1 system NULL NULL NULL NULL 1 100.00
  71. -1 PRIMARY t1 system NULL NULL NULL NULL 1 100.00
  72. -1 PRIMARY t2 ALL NULL NULL NULL NULL 2 100.00 Using where
  73. +1 PRIMARY t1 ALL NULL NULL NULL NULL 1 100.00
  74. +1 PRIMARY <subquery3> eq_ref distinct_key distinct_key 5 func 1 100.00
  75. +1 PRIMARY t2 ALL NULL NULL NULL NULL 2 100.00 Using where; Using join buffer (flat, BNL join)
  76. +3 MATERIALIZED t1 ALL NULL NULL NULL NULL 1 100.00
  77. Warnings:
  78. -Note 1003 select `test`.`t2`.`a` AS `a`,0 AS `a`,0 AS `b` from `test`.`t2` semi join (dual) where 1
  79. +Note 1003 select `test`.`t2`.`a` AS `a`,`test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b` from `test`.`t1` semi join (`test`.`t1`) left join `test`.`t2` on((`test`.`t1`.`a` <> 0)) where 1
  80. SELECT * FROM t2 RIGHT JOIN v1 AS t ON t.a != 0
  81. WHERE t.a IN (SELECT b FROM t1);
  82. a a b
  83. @@ -358,11 +361,12 @@
  84. SELECT * FROM t2 RIGHT JOIN v1 AS t ON t.a != 0
  85. WHERE t.a IN (SELECT b FROM t1);
  86. id select_type table type possible_keys key key_len ref rows filtered Extra
  87. -1 PRIMARY t1 system NULL NULL NULL NULL 1 100.00
  88. -1 PRIMARY t1 system NULL NULL NULL NULL 1 100.00
  89. -1 PRIMARY t2 ALL NULL NULL NULL NULL 2 100.00 Using where
  90. +1 PRIMARY t1 ALL NULL NULL NULL NULL 1 100.00
  91. +1 PRIMARY <subquery2> eq_ref distinct_key distinct_key 5 func 1 100.00
  92. +1 PRIMARY t2 ALL NULL NULL NULL NULL 2 100.00 Using where; Using join buffer (flat, BNL join)
  93. +2 MATERIALIZED t1 ALL NULL NULL NULL NULL 1 100.00
  94. Warnings:
  95. -Note 1003 select `test`.`t2`.`a` AS `a`,0 AS `a`,0 AS `b` from `test`.`t2` semi join (dual) where 1
  96. +Note 1003 select `test`.`t2`.`a` AS `a`,`test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b` from `test`.`t1` semi join (`test`.`t1`) left join `test`.`t2` on((`test`.`t1`.`a` <> 0)) where 1
  97. DROP VIEW v1;
  98. DROP TABLE t1,t2;
  99. #
  100. @@ -431,9 +435,9 @@
  101. WHERE t3.b IN (SELECT v1.b FROM v1, t2
  102. WHERE t2.c = v1.c AND t2.c = v1.b AND v1.b = t3.c);
  103. id select_type table type possible_keys key key_len ref rows Extra
  104. -1 PRIMARY t2 system NULL NULL NULL NULL 1
  105. -1 PRIMARY t3 ALL NULL NULL NULL NULL 2 Using where
  106. -1 PRIMARY <derived3> ALL NULL NULL NULL NULL 3 Using where; FirstMatch(t3); Using join buffer (flat, BNL join)
  107. +1 PRIMARY t2 ALL NULL NULL NULL NULL 1 Start temporary
  108. +1 PRIMARY t3 ALL NULL NULL NULL NULL 2 Using where; Using join buffer (flat, BNL join)
  109. +1 PRIMARY <derived3> ALL NULL NULL NULL NULL 3 Using where; End temporary; Using join buffer (incremental, BNL join)
  110. 3 DERIVED t1 ALL NULL NULL NULL NULL 3
  111. SELECT * FROM t3
  112. WHERE t3.b IN (SELECT v1.b FROM v1, t2
  113. @@ -446,8 +450,8 @@
  114. WHERE t3.b IN (SELECT v1.b FROM v1, t2
  115. WHERE t2.c = v1.c AND t2.c = v1.b AND v1.b = t3.c);
  116. id select_type table type possible_keys key key_len ref rows Extra
  117. -1 PRIMARY t2 system NULL NULL NULL NULL 1
  118. -1 PRIMARY <derived3> ref key1 key1 10 const,const 0 Start temporary
  119. +1 PRIMARY t2 ALL NULL NULL NULL NULL 1 Using where; Start temporary
  120. +1 PRIMARY <derived3> ref key1 key1 10 test.t2.c,test.t2.c 2
  121. 1 PRIMARY t3 ALL NULL NULL NULL NULL 2 Using where; End temporary; Using join buffer (flat, BNL join)
  122. 3 DERIVED t1 ALL NULL NULL NULL NULL 3
  123. SELECT * FROM t3