Commit graph

31 commits

Author SHA1 Message Date
gshchepa/uchum@gleb.loc
1674d8dc35 Merge gleb.loc:/home/uchum/work/bk/5.0-opt
into  gleb.loc:/home/uchum/work/bk/5.1-opt
2007-07-13 19:36:10 +05:00
igor@olga.mysql.com
7f64144bf0 Fixed bug #29604.
A bug in the restore_prev_nj_state function allowed interleaving 
inner tables of outer join operations with outer tables. With the
current implementation of the nested loops algorithm it could lead
to wrong result sets for queries with nested outer joins.
Another bug in this procedure effectively blocked evaluation of some
valid execution plans for queries with nested outer joins.
2007-07-11 18:45:35 -07:00
gkodinov/kgeorge@macbook.gmz
fe03f6bbe0 Bug #27531: 5.1 part of the fix
- Renamed "Using join cache" to "Using join buffer".
- "Using join buffer" is now printed on the last
  table that "reads" from the join buffer cache.
2007-05-29 15:58:18 +03:00
gkodinov/kgeorge@magare.gmz
306371a850 bug #27531: 5.1 part of the fix:
- added join cache indication in EXPLAIN (Extra column).
 - prefer filesort over full scan over 
   index for ORDER BY (because it's faster).
 - when switching from REF to RANGE because
   RANGE uses longer key turn off sort on
   the head table only as the resulting 
   RANGE access is a candidate for join cache
   and we don't want to disable it by sorting
   on the first table only.
2007-05-04 18:06:06 +03:00
gluh@eagle.(none)
7849d31923 Merge mysql.com:/home/gluh/MySQL/Merge/5.0-opt
into  mysql.com:/home/gluh/MySQL/Merge/5.1-opt
2007-02-02 10:25:45 +04:00
gkodinov/kgeorge@macbook.gmz
16d2d68257 BUG#25575: ERROR 1052 (Column in from clause is ambiguous) with sub-join
Two problems here:

 Problem 1:

 While constructing the join columns list the optimizer does as follows:
  1. Sets the join_using_fields/natural_join members of the right JOIN 
   operand.
  2. Makes a "table reference" (TABLE_LIST) to parent the two tables.
  3. Assigns the join_using_fields/is_natural_join of the wrapper table
   using join_using_fields/natural_join of the rightmost table
  4. Sets join_using_fields to NULL for the right JOIN operand.
  5. Passes the parent table up to the same procedure on the upper 
   level.

 Step 1 overrides the the join_using_fields that are set for a nested 
 join wrapping table in step 4.
 Fixed by making a designated variable SELECT_LEX::prev_join_using to 
 pass the data from step 1 to step 4 without destroying the wrapping 
 table data.

 Problem 2:

 The optimizer checks for ambiguous columns while transforming 
 NATURAL JOIN/JOIN USING to JOIN ON. While doing that there was no
 distinction between columns that are used in the generated join
 condition (where ambiguity can be checked) and the other columns
 (where ambiguity can be checked only when resolving references
 coming from outside the JOIN construct itself).
 Fixed by allowing the non-USING columns to be present in multiple 
 copies in both sides of the join and moving the ambiguity check 
 to the place where unqualified references to the join columns are
 resolved (find_field_in_natural_join()).
2007-01-31 16:04:38 +02:00
gluh@eagle.(none)
42e49682b7 Merge mysql.com:/home/gluh/MySQL/Merge/5.0-opt
into  mysql.com:/home/gluh/MySQL/Merge/5.1-opt
2007-01-10 14:14:22 +04:00
igor@olga.mysql.com
08369f4bce Fixed bug #24345.
This bug appeared after the patch for bug 21390 that had added some code
to handle outer joins with no matches after substitution of a const
table in an efficient way. That code as it is cannot be applied to the case
of nested outer join operations. Being applied to the queries with
nested outer joins the code can cause crashes or wrong result sets.
The fix blocks row substitution for const inner tables of an outer join
if the inner operand is not a single table.
2007-01-03 12:16:03 -08:00
sergefp@mysql.com
699291a8e6 BUG#14940 "MySQL choose wrong index", v.2
- Make the range-et-al optimizer produce E(#table records after table 
                                           condition is applied),
- Make the join optimizer use this value,
- Add "filtered" column to EXPLAIN EXTENDED to show 
  fraction of records left after table condition is applied
- Adjust test results, add comments
2006-07-28 21:27:01 +04:00
igor@rurik.mysql.com
0f9ab67d41 Fixed bug #18279: crash in the cases when on conditions are moved
out of a nested join to the on conditions for the nest.
The bug happened due to:
1. The function simplify_joins could change on expressions for nested joins.
   Yet modified on expressions were not saved in prep_on_expr.
2. On expressions were not restored for nested joins in 
   reinit_stmt_before_use.
2006-03-29 16:45:29 -08:00
igor@rurik.mysql.com
eb8507208e Fixed bug #16260.
The problem has manifested itself in the cases when we have a nested outer join
for which it can be inferred that one of the inner tables is a single row table.
2006-01-27 21:20:28 -08:00
sergefp@mysql.com
e58314d482 BUG#16393: Let the 'ref' optimizer use ON condition of nested join to construct
'ref' accesses to all tables that are direct children of the nested join and are 
not inner wrt their siblings.
2006-01-13 23:55:30 +03:00
pem@mysql.com
01de5ef5af Remove t3 in join_nested.test 2005-11-24 19:51:52 +01:00
timour@mysql.com
7397abc0c7 table t7 was not dropped at the end 2005-11-24 16:11:59 +02:00
sergefp@mysql.com
1441f1c188 BUG#13126: When choosing join order for join with nested joins, don't produce join
orders that cannot be handled by the executioner.
2005-10-25 19:28:27 +04:00
ramil@mysql.com
920e456549 fix for bug #13545: Server crash caused by select query. 2005-09-29 19:34:21 +05:00
timour@mysql.com
e040300393 WL#2486 - natural and using join according to SQL:2003
* Provide backwards compatibility extension to name resolution of
  coalesced columns. The patch allows such columns to be qualified
  with a table (and db) name, as it is in 4.1.
  Based on a patch from Monty.

* Adjusted tests accordingly to test both backwards compatible name
  resolution of qualified columns, and ANSI-style resolution of
  non-qualified columns.
  For this, each affected test has two versions - one with qualified
  columns, and one without.
2005-08-23 18:08:04 +03:00
timour@mysql.com
354ce1d024 Merge mysql.com:/home/timka/mysql/src/5.0-virgin
into  mysql.com:/home/timka/mysql/src/5.0-2486-merge
2005-08-12 19:27:54 +03:00
timour@mysql.com
a247282aa6 Implementation of WL#2486 -
"Process NATURAL and USING joins according to SQL:2003".

* Some of the main problems fixed by the patch:
  - in "select *" queries the * expanded correctly according to
    ANSI for arbitrary natural/using joins
  - natural/using joins are correctly transformed into JOIN ... ON
    for any number/nesting of the joins.
  - column references are correctly resolved against natural joins
    of any nesting and combined with arbitrary other joins.

* This patch also contains a fix for name resolution of items
  inside the ON condition of JOIN ... ON - in this case items must
  be resolved only against the JOIN operands. To support such
  'local' name resolution, the patch introduces a stack of
  name resolution contexts used at parse time.

NOTICE:
- This patch is not complete in the sense that
  - there are 2 test cases that still do not pass -
    one in join.test, one in select.test. Both are marked
    with a comment "TODO: WL#2486".
  - it does not include a new test specific for the task
2005-08-12 17:57:19 +03:00
igor@rurik.mysql.com
73db3fdf46 mysql_priv.h:
Fixed bug #12154: a query returned: Column <name> cannot be null.
  The problem was due to a bug in the function setup_table_map:
  the flag maybe_null was set up incorrectly for inner tables of
  nested outer joins.
join_nested.result, join_nested.test:
  Added a test case for bug #12154.
2005-08-05 16:43:35 -07:00
igor@rurik.mysql.com
4bfe1cc843 join_nested.result, join_nested.test:
Added a teast case for bug #11284.
sql_select.cc:
  Fixed bug #11284.
  Optimization with empty inner table currently cannot be
  used in the case of nested outer join.
2005-06-15 05:56:19 -07:00
monty@mysql.com
47bbf768d4 Fixes after merge with 4.1
FOUND is not a reserved keyword anymore
Added Item_field::set_no_const_sub() to be able to mark fields that can't be substituted
Added 'simple_select' method to be able to quickly determinate if a select_result is a normal SELECT
Note that the 5.0 tree is not yet up to date: Sanja will have to fix multi-update-locks for this merge to be complete
2004-11-03 12:39:38 +02:00
igor@rurik.mysql.com
4c8e391718 table.h, sql_select.h:
Added the code processing on expressions for applying
  multiple equalities.
sql_select.cc:
  Post-merge fixes for Item_equal patch.
  Added the code processing on expressions for applying
  multiple equalities.
Many files:
  Post-merge fixes for Item_equal patch.
item_cmpfunc.cc:
  Post-merge fixes for Item_equal patch.
  Fixed a problem when an equality field=const cannot be applied to
  the predicate P(field,c) for constant propagation as a conversion
  of field is needed.
item.h, item.cc:
  Fixed a problem when an equality field=const cannot be applied to
  the predicate P(field,c) for constant propagation as a conversion
  of field is needed.
2004-10-19 14:12:55 -07:00
igor@rurik.mysql.com
49094f58f9 join_nested.test, join_nested.result:
Added a case for bug #4976 when one of the inner tables is empty.
select.result, join.result:
  Reversed the previous change of the erronious fix for bug #4976.
sql_select.cc:
  The previous fix for bug 4976 was reversed as it
  erroniously converted an outer join into an innner join
  when on_expression does not refer to outer tables.
  This is not valid if inner tables return an empty set.
  Setting dependency on outer tables was added for the above cases.
  To fix the crash in the test case of bug #4976  
  a guard was added that blocks running the crashing code for
  nested outer joins.
2004-08-12 23:41:06 -07:00
igor@rurik.mysql.com
43bf2d055f join.result, select.result:
Fixed bug #4976.
join_nested.result, join_nested.test:
  Added a test case for bug #4976.
sql_select.cc:
  Applied conversion from an outer join to an inner join 
  when the on expression does not depend on the outer table.
  It fixed bug #4976.
2004-08-10 17:32:15 -07:00
igor@rurik.mysql.com
b805d12587 join_nested.result, join_nested.test:
Added a test case for bug #4922.
sql_select.cc:
  Blocked an optimization performed by join_read_const_table when
  applied to an inner table of a nested outer join.
  It was done to fix bug #4922.
sql_yacc.yy:
  Fixed a typo bug in the rule for join_table.
2004-08-06 10:22:20 -07:00
bell@sanja.is.com.ua
1e3f10a4b1 mark subquery in the FROM clause like derived and quoate all identifiers (BUG#4609) 2004-07-20 08:48:28 +03:00
bell@sanja.is.com.ua
1b54d08a1c right join print fixed 2004-07-03 01:08:46 +03:00
bell@sanja.is.com.ua
ce19102645 fixed join_nested test independence of environment
spaces at line end in fresh definitions removed
fixed printing of nested joins (BUG#4352)
2004-07-01 23:46:43 +03:00
igor@rurik.mysql.com
d70f886f17 subselect2.result, select.result:
Post-merge fixes for nested joins.
  The join_tab_cmp function in sql_select has been changed.
join_nested.result:
  Post-merge fixes for nested joins. 
  The join_tab_cmp function in sql_select has been changed
sql_select.cc:
  Post-merge fixes for nested joins.
  Avoided re-execution of eliminate_not_funcs and simplify_joins
  in optimize_cond.
  Changed the join_tab_cmp function to take into account
  the dependent relation.
sql_lex.cc, sql_lex.h:
  Added the first_cond_optimization flag to st_select_lex to avoid
  re-execution of some optimizations in optimize_cond.
sql_base.cc:
  Post-merge fixes for nested joins. 
  Fixed problems with a proper column list substituted for '*' in
  queries with natural joins.
2004-06-30 05:54:32 -07:00
igor@rurik.mysql.com
356cbe4fa2 join_nested.test, join_nested.result:
new file
Many files:
  Nested joins added.
2004-06-10 22:27:21 -07:00