An error occurred fetching the project authors.
  1. 06 Jun, 2011 1 commit
    • Igor Babaev's avatar
      Fixed LP bug #793436. · db0c3406
      Igor Babaev authored
      When looking for the execution plan of a derived table to be materialized
      JOIN::optimize finds  out that all joined tables of the derived table
      contain not more than one row then the derived table should be maretialized
      at the optimization stage.
      Added a test case for the bug.
      Adjusted results in other test cases.
      db0c3406
  2. 16 May, 2011 1 commit
    • unknown's avatar
      Fix LP BUG#778413 · 4a9c027a
      unknown authored
      Analysis:
      The subquery is evaluated first during ref-optimization of the outer
      query because the subquery is considered constant from the perspective
      of the outer query. Thus an attempt is made to evaluate the MAX subquery
      and use the new constant to drive an index nested loops join.
      During this evaluation the inner-most subquery replaces the JOIN_TAB
      with a new one that fetches the data from a temp table.
      The function select_describe crashes at the lines:
              TABLE_LIST *real_table= table->pos_in_table_list; 
      	item_list.push_back(new Item_string(real_table->alias,
      					    strlen(real_table->alias),
      					    cs));
      because 'table' is a temp table, and it has no corresponding table
      reference. This 'real_table' is NULL, and real_table->alias results
      in a crash.
      
      Solution:
      In the spirit of MWL#89 prevent the evaluation of expensive predicates
      during optimization. This patch prevents the evaluation of expensive
      predicates during ref optimization.
      
      
      sql/item_subselect.h:
        Remove unused class member. Not needed for the fix, but noticed now and removed.
      4a9c027a
  3. 10 May, 2011 1 commit
    • Sergey Petrunya's avatar
      BUG#779885: Crash in eliminate_item_equal with materialization=on in maria-5.3 · 30575353
      Sergey Petrunya authored
      - In eliminate_item_equal(), we could end up in a situation where:
        = The multiple equality has a constant C1 (and so it is the "head item")
        = The join order was such that we've generated "sj_inner_table1=C1" equality,
          and now are looking to generate "sj_inner_table2_=..." equality. 
        When looking for what should be the other member of equality, we run
      
            Item *head_item= current_sjm? current_sjm_head: head;
        
        which sees current_sjm!=NULL, and takes current_sjm_head (which is NULL because 
        the constant C1 is the head for all cases).
      
      - Fixed in a trivial way: take current_sjm_head if we don't have constant.
      30575353
  4. 04 May, 2011 3 commits
    • unknown's avatar
      MWL#89 · f4878475
      unknown authored
      Adjusted test results after merge.
      f4878475
    • Igor Babaev's avatar
      Fixed LP bug #751350. · e3e2358f
      Igor Babaev authored
      The third parameter in the call of make_cond_for_table() that
      built the pushed condition containing only outer references
      was incorrect. This condition appeared for the first time in
      the patch fixing bug 729039.
        
      e3e2358f
    • Oleksandr Byelkin's avatar
      Moving max/min optimization from prepare to optimization phase. MWL#148 · 7b797fe6
      Oleksandr Byelkin authored
      mysql-test/r/explain.result:
        fixed results (new item)
      mysql-test/r/subselect.result:
        fixed results (new item)
      mysql-test/r/subselect_no_mat.result:
        fixed results (new item)
      mysql-test/r/subselect_no_opts.result:
        fixed results (new item)
      mysql-test/r/subselect_no_semijoin.result:
        Fixed results (new item)
      mysql-test/suite/pbxt/r/subselect.result:
        Fixed results (new item)
      mysql-test/t/explain.test:
        Fixed results (correct behaviour)
      sql/item_cmpfunc.cc:
        Pass through  for max/min
      sql/item_subselect.cc:
        moving max/min
      sql/item_subselect.h:
        moving max/min
      sql/mysql_priv.h:
        new uncacheble flags added
      sql/opt_subselect.cc:
        maxmin moved.
      sql/opt_subselect.h:
        New function for maxmin.
      sql/sql_class.h:
        debug code
      sql/sql_lex.cc:
        Fixed flags.
        Limit setting fixed.
      sql/sql_lex.h:
        2 new flags.
      sql/sql_select.cc:
        Prepare divided on 2 function to be able recollect some info after transformation.
      sql/sql_select.h:
        Prepare divided on 2 functions.
      7b797fe6
  5. 20 Apr, 2011 1 commit
    • unknown's avatar
      Fix LP BUG#715069 · 43acceeb
      unknown authored
      Analysis:
      The wrong result is a consquence of sorting the subquery
      result and then selecting only the first row due to the
      artificial LIMIT 1 introduced by the fix_fields phase.
      Normally, if there is an ORDER BY in a subquery, the ORDER
      is removed (Item_in_subselect::select_in_like_transformer),
      however if a GROUP BY is transformed into ORDER, this happens
      later, after the removal of the ORDER clause of subqueries, so
      we end up with a subquery with an ORDER clause, and an artificially
      added LIMIT 1.
      
      The reason why the same works in the main 5.3 without MWL#89, is
      that the 5.3 performs all subquery transformations, including
      IN->EXISTS before JOIN::optimize(). The beginning of JOIN::optimize
      does:
        if (having || (select_options & OPTION_FOUND_ROWS))
          select_limit= HA_POS_ERROR;
      which sets the limit back to infinity, thus 5.3 sorts the whole
      subquery result, and IN performs the lookup into all subquery result
      rows.
      
      Solution:
      Sorting of subqueries without LIMIT is meaningless. Since LIMIT in
      subqueries is not supported, the patch removes sorting by setting
        join->skip_sort_order= true
      for each subquery JOIN object. This improves a number of execution
      plans to not perform unnecessary sorting at all.
      43acceeb
  6. 07 Apr, 2011 1 commit
  7. 08 Mar, 2011 1 commit
    • Igor Babaev's avatar
      Fixed LP bug #729039. · 3d3d5f1d
      Igor Babaev authored
      If join condition is of the form <t2.key>=<t1.no_key> then the server
      performs no index look-ups when looking for matching rows of t2 for
      the rows from t1 with t1.no_key=NULL. It happens because the function
      add_not_null_conds() injects an additional condition of the form 
      IS NOT NULL(<t1.no_key>) into the WHERE condition.
      However if the join condition was of the form <t.key>=<outer_ref> no
      additional null rejecting predicate was generated. This could lead
      to extra records in the result set if the value of <outer_ref> happened
      to be NULL.
      The new code injects null rejecting predicates of the form 
      IS NOT NULL(<outer_ref>) and evaluates them before the first row
      the subquery is constructed.
      3d3d5f1d
  8. 05 Mar, 2011 1 commit
    • Sergey Petrunya's avatar
      BUG#727667 Wrong result with OR + NOT NULL in maria-5.3 · 76165dc7
      Sergey Petrunya authored
      - put the code that sets HA_NULL_PART bit back
      - Fix test_if_ref/part_of_refkey() so that 
        = NULL-ability of lookup columns does not prevent the equality 
          from being removed (we now have early/late NULLs filtering which 
          will filter out NULL values)
        = equality is not removed if it is ref_or_null access, and the value 
          of the lookup column can alternate between the lookup value and NULL.
      76165dc7
  9. 03 Feb, 2011 1 commit
    • unknown's avatar
      MWL#89 · 648e6046
      unknown authored
      Adjusted test cases in accordance with the implementation.
      648e6046
  10. 13 Jan, 2011 1 commit
    • Sergey Petrunya's avatar
      Backport of (see below) + temporary measures to make SJ-Materialization work with join buffering. · d2cbb104
      Sergey Petrunya authored
      Date: Mon, 01 Nov 2010 15:15:25 -0000
      3272 Roy Lyseng        2010-11-01
      Bug#52068: Optimizer generates invalid semijoin materialization plan
      
      When MaterializeScan semijoin strategy was used and there were one
      or more outer dependent tables before the semijoin tables, the scan
      over the materialized table was not properly reset for each row of
      the prefix outer tables.
      
      Example: suppose we have a join order:
      
        ot1 SJ-Mat-Scan(it2 it3)  ot4
      
      Notice that this is called a MaterializeScan, even though there is an
      outer table ahead of the materialized tables. Usually a MaterializeScan
      has the outer tables after the materialized table, but this is
      a special (but legal) case with outer dependent tables both before and
      after the materialized table.
      
      For each qualifying row from ot1, a new scan over the materialized
      table must be set up. The code failed to do that, so all scans after
      the first one returned zero rows from the materialized table.
      d2cbb104
  11. 18 Oct, 2010 2 commits
  12. 12 Oct, 2010 1 commit
  13. 06 Sep, 2010 1 commit
    • unknown's avatar
      Fixed LP BUG#615760: Check on double cache assignment added into the transformation methods. · d6a9b522
      unknown authored
      Cache parameters print added in EXPLAIN EXTENDED output.
      
      mysql-test/r/compare.result:
        Cache parameters print added in EXPLAIN EXTENDED output.
      mysql-test/r/group_by.result:
        Cache parameters print added in EXPLAIN EXTENDED output.
      mysql-test/r/subselect.result:
        Cache parameters print added in EXPLAIN EXTENDED output.
      mysql-test/r/subselect3.result:
        Cache parameters print added in EXPLAIN EXTENDED output.
      mysql-test/r/subselect3_jcl6.result:
        Cache parameters print added in EXPLAIN EXTENDED output.
      mysql-test/r/subselect4.result:
        Cache parameters print added in EXPLAIN EXTENDED output.
      mysql-test/r/subselect_cache.result:
        Added test suite for LP BUG#615760
      mysql-test/r/subselect_mat.result:
        Cache parameters print added in EXPLAIN EXTENDED output.
      mysql-test/r/subselect_no_mat.result:
        Cache parameters print added in EXPLAIN EXTENDED output.
      mysql-test/r/subselect_no_opts.result:
        Cache parameters print added in EXPLAIN EXTENDED output.
      mysql-test/r/subselect_no_semijoin.result:
        Cache parameters print added in EXPLAIN EXTENDED output.
      mysql-test/r/subselect_sj.result:
        Cache parameters print added in EXPLAIN EXTENDED output.
      mysql-test/r/subselect_sj_jcl6.result:
        Cache parameters print added in EXPLAIN EXTENDED output.
      mysql-test/suite/pbxt/r/subselect.result:
        Cache parameters print added in EXPLAIN EXTENDED output.
      mysql-test/t/subselect_cache.test:
        Cache parameters print added in EXPLAIN EXTENDED output.
      sql/item.cc:
        Item::set_expr_cache result fixed according to its description.
        
        Cache parameters print added in EXPLAIN EXTENDED output.
      sql/item.h:
        Cache parameters print added in EXPLAIN EXTENDED output.
      sql/item_cmpfunc.cc:
        Check on double cache assignment added into the transformation methods.
      sql/item_cmpfunc.h:
        Check on double cache assignment added into the transformation methods.
      sql/item_subselect.cc:
        Check on double cache assignment added into the transformation methods.
      sql/item_subselect.h:
        Check on double cache assignment added into the transformation methods.
      sql/sql_expression_cache.cc:
        Cache parameters print added.
      sql/sql_expression_cache.h:
        Cache parameters print added.
      sql/sql_select.cc:
        Removed unused method (now it is impossible to make double transformation with the cache).
      sql/sql_select.h:
        Removed unused method.
      d6a9b522
  14. 31 Aug, 2010 1 commit
    • unknown's avatar
      LP BUG#615752 fix. Expression cache added to EXPLAIN EXTENDED output. · 97199ad5
      unknown authored
      mysql-test/r/compare.result:
        Expression cache added to EXPLAIN EXTENDED output.
      mysql-test/r/explain.result:
        Expression cache added to EXPLAIN EXTENDED output.
      mysql-test/r/group_by.result:
        Expression cache added to EXPLAIN EXTENDED output.
      mysql-test/r/subselect.result:
        Expression cache added to EXPLAIN EXTENDED output.
      mysql-test/r/subselect3.result:
        Expression cache added to EXPLAIN EXTENDED output.
      mysql-test/r/subselect3_jcl6.result:
        Expression cache added to EXPLAIN EXTENDED output.
      mysql-test/r/subselect4.result:
        Expression cache added to EXPLAIN EXTENDED output.
      mysql-test/r/subselect_mat.result:
        Expression cache added to EXPLAIN EXTENDED output.
      mysql-test/r/subselect_no_mat.result:
        Expression cache added to EXPLAIN EXTENDED output.
      mysql-test/r/subselect_no_opts.result:
        Expression cache added to EXPLAIN EXTENDED output.
      mysql-test/r/subselect_no_semijoin.result:
        Expression cache added to EXPLAIN EXTENDED output.
      mysql-test/r/subselect_sj.result:
        Expression cache added to EXPLAIN EXTENDED output.
      mysql-test/r/subselect_sj_jcl6.result:
        Expression cache added to EXPLAIN EXTENDED output.
      sql/item.h:
        Expression cache added to EXPLAIN EXTENDED output.
      97199ad5
  15. 16 Jul, 2010 1 commit
    • Sergey Petrunya's avatar
      Fix @@optimizer_switch support · 13058d80
      Sergey Petrunya authored
      - Let "mysqld  --help --verbose" list all optimizer options
      - Make it possible to add new @@optimizer_switch flags w/o causing .result 
        changes all over the testsuite:
        = Remove "select @@optimizer_switch" from tests that do not need all switches
        = Move @@optimizer_switch-specific tests to t/optimizer_switch.test
      13058d80
  16. 10 Jul, 2010 1 commit
    • unknown's avatar
      Subquery cache (MWL#66) added. · ceb5468f
      unknown authored
      libmysqld/Makefile.am:
        The new file added.
      mysql-test/r/index_merge_myisam.result:
        subquery_cache optimization option added.
      mysql-test/r/myisam_mrr.result:
        subquery_cache optimization option added.
      mysql-test/r/subquery_cache.result:
        The subquery cache tests added.
      mysql-test/r/subselect3.result:
        Subquery cache switched off to avoid changing read statistics.
      mysql-test/r/subselect3_jcl6.result:
        Subquery cache switched off to avoid changing read statistics.
      mysql-test/r/subselect_no_mat.result:
        subquery_cache optimization option added.
      mysql-test/r/subselect_no_opts.result:
        subquery_cache optimization option added.
      mysql-test/r/subselect_no_semijoin.result:
        subquery_cache optimization option added.
      mysql-test/r/subselect_sj.result:
        subquery_cache optimization option added.
      mysql-test/r/subselect_sj_jcl6.result:
        subquery_cache optimization option added.
      mysql-test/t/subquery_cache.test:
        The subquery cache tests added.
      mysql-test/t/subselect3.test:
        Subquery cache switched off to avoid changing read statistics.
      sql/CMakeLists.txt:
        The new file added.
      sql/Makefile.am:
        The new files added.
      sql/item.cc:
        Expression cache item (Item_cache_wrapper) added.
        Item_ref and Item_field fixed for correct usage of result field and fast resolwing in SP.
      sql/item.h:
        Expression cache item (Item_cache_wrapper) added.
        Item_ref and Item_field fixed for correct usage of result field and fast resolwing in SP.
      sql/item_cmpfunc.cc:
        Subquery cache added.
      sql/item_cmpfunc.h:
        Subquery cache added.
      sql/item_subselect.cc:
        Subquery cache added.
      sql/item_subselect.h:
        Subquery cache added.
      sql/item_sum.cc:
        Registration of subquery parameters added.
      sql/mysql_priv.h:
        subquery_cache optimization option added.
      sql/mysqld.cc:
        subquery_cache optimization option added.
      sql/opt_range.cc:
        Fix due to subquery cache.
      sql/opt_subselect.cc:
        Parameters of the function cahnged.
      sql/procedure.h:
        .h file guard added.
      sql/sql_base.cc:
        Registration of subquery parameters added.
      sql/sql_class.cc:
        Option to allow add indeces to temporary table.
      sql/sql_class.h:
        Item iterators added.
        Option to allow add indeces to temporary table.
      sql/sql_expression_cache.cc:
        Expression cache for caching subqueries added.
      sql/sql_expression_cache.h:
        Expression cache for caching subqueries added.
      sql/sql_lex.cc:
        Registration of subquery parameters added.
      sql/sql_lex.h:
        Registration of subqueries and subquery parameters added.
      sql/sql_select.cc:
        Subquery cache added.
      sql/sql_select.h:
        Subquery cache added.
      sql/sql_union.cc:
        A new parameter to the function added.
      sql/sql_update.cc:
        A new parameter to the function added.
      sql/table.cc:
        Procedures to manage temporarty tables index added.
      sql/table.h:
        Procedures to manage temporarty tables index added.
      storage/maria/ha_maria.cc:
        Fix of handler to allow destoy a table in case of error during the table creation.
      storage/maria/ha_maria.h:
        .h file guard added.
      storage/myisam/ha_myisam.cc:
        Fix of handler to allow destoy a table in case of error during the table creation.
      ceb5468f
  17. 26 Jun, 2010 1 commit
  18. 27 May, 2010 1 commit
    • Sergey Petrunya's avatar
      MWL#90: Subqueries: Inside-out execution for non-semijoin materialized... · 0cc37246
      Sergey Petrunya authored
      MWL#90: Subqueries: Inside-out execution for non-semijoin materialized subqueries that are AND-parts of the WHERE
      - Change "SUBQUERY#n" to "<subquery{n}>" in EXPLAIN output. We need to it to be
        lowercase so that EXPLAIN results do not differ in case between systems with
        case-sensitive and case-insensitive filesystems.
      - Remove garbage comments, add better comments.
      0cc37246
  19. 26 May, 2010 1 commit
  20. 25 May, 2010 1 commit
    • Sergey Petrunya's avatar
      MWL#90: Subqueries: Inside-out execution for non-semijoin materialized... · 62bf7f61
      Sergey Petrunya authored
      MWL#90: Subqueries: Inside-out execution for non-semijoin materialized subqueries that are AND-parts of the WHERE
      - Code cleanu.
      - Make MWL#90 code require @@optimizer_switch='semijoin=on'
      - Update test results with the above
      - Fork subselect_mat.test - we want to check both semi-join materialization, 
        which now has broader scope and non-semijoin materialization.
      62bf7f61
  21. 06 Apr, 2010 1 commit
  22. 05 Apr, 2010 1 commit
  23. 11 Mar, 2010 1 commit
    • unknown's avatar
      MWL#68 Subquery optimization: Efficient NOT IN execution with NULLs · 3d2a7460
      unknown authored
      This patch does three things:
      - It adds the possibility to force the execution of top-level [NOT] IN
        subquery predicates via the IN=>EXISTS transformation. This is done by
        setting both optimizer switches partial_match_rowid_merge and
        partial_match_table_scan to "off".
      - It adjusts all test cases where the complete optimizer_switch is
        selected because now we have two more switches.
      - For those test cases where the plan changes because of the new available
        strategies, we switch off both partial match strategies in order to
        force the "old" IN=>EXISTS strategy. This is done because most of these
        test cases specifically test bugs in this strategy.
      
      sql/opt_subselect.cc:
        Adds the possibility to force the execution of top-level [NOT] IN
        subquery predicates via the IN=>EXISTS transformation. This is done by
        setting both optimizer switches partial_match_rowid_merge and
        partial_match_table_scan to "off".
      3d2a7460
  24. 21 Feb, 2010 1 commit
  25. 17 Feb, 2010 2 commits
  26. 17 Jan, 2010 2 commits
  27. 23 Dec, 2009 1 commit
    • Georgi Kodinov's avatar
      Bug #49512 : subquery with aggregate function crash · d2f61748
      Georgi Kodinov authored
        subselect_single_select_engine::exec()
      
      When a subquery doesn't need to be evaluated because
      it returns only aggregate functions and these aggregates
      can be calculated from the metadata about the table it
      was not updating all the relevant members of the JOIN 
      structure to reflect that this is a constant query.
      This caused problems to the enclosing subquery 
      ('<> SOME' in the test case above) trying to read some
      data about the tables.
      
      Fixed by setting const_tables to the number of tables 
      when the SELECT is optimized away.
      d2f61748
  28. 19 Jan, 2010 1 commit
  29. 18 Jan, 2010 1 commit
  30. 02 Feb, 2010 1 commit
  31. 15 Dec, 2009 3 commits
    • Georgi Kodinov's avatar
      Bug #48709: Assertion failed in sql_select.cc:11782: · b72f2789
      Georgi Kodinov authored
       int join_read_key(JOIN_TAB*)
      
      The eq_ref access method TABLE_REF (accessed through 
      JOIN_TAB) to save state and to track if this is the 
      first row it finds or not.
      This state was not reset on subquery re-execution
      causing an assert.
      
      Fixed by resetting the state before the subquery 
      re-execution.
      b72f2789
    • Georgi Kodinov's avatar
      Bug #48709: Assertion failed in sql_select.cc:11782: · 188c6f8c
      Georgi Kodinov authored
       int join_read_key(JOIN_TAB*)
      
      The eq_ref access method TABLE_REF (accessed through 
      JOIN_TAB) to save state and to track if this is the 
      first row it finds or not.
      This state was not reset on subquery re-execution
      causing an assert.
      
      Fixed by resetting the state before the subquery 
      re-execution.
      188c6f8c
    • Sergey Petrunya's avatar
      Backport into MariaDB-5.2 the following: · 96e092dc
      Sergey Petrunya authored
      WL#2474 "Multi Range Read: Change the default MRR implementation to implement new MRR interface"
      WL#2475 "Batched range read functions for MyISAM/InnoDb"
              "Index condition pushdown for MyISAM/InnoDB"
      Igor's fix from sp1r-igor@olga.mysql.com-20080330055902-07614:
        There could be observed the following problems:
        1. EXPLAIN did not mention pushdown conditions from on expressions in the 
        'extra' column.  As a result if a query had no where conditions pushed 
        down to a table, but had on conditions pushed to this table the 'extra' 
        column in the EXPLAIN for the table missed 'using where'.
        2. Conditions for ref access were not eliminated from on expressions 
        though such conditions were eliminated from the where condition.
      96e092dc
  32. 25 Nov, 2009 2 commits
    • MySQL Build Team's avatar
      Backport into build-200911241145-5.1.40sp1 · 49383941
      MySQL Build Team authored
      > ------------------------------------------------------------
      > revno: 3181
      > revision-id: alexey.kopytov@sun.com-20091016201951-fsht0wm8xn8vkzsx
      > parent: joerg@mysql.com-20091016164025-kb4sbrggq5o7zufc
      > committer: Alexey Kopytov <Alexey.Kopytov@Sun.com>
      > branch nick: mysql-5.1-bugteam
      > timestamp: Sat 2009-10-17 00:19:51 +0400
      > message:
      >   Bug #47123: Endless 100% CPU loop with STRAIGHT_JOIN 
      >    
      >   The problem was in incorrect handling of predicates involving 
      >   NULL as a constant value by the range optimizer. 
      >    
      >   For example, when creating a SEL_ARG node from a condition of 
      >   the form "field < const" (which would normally result in the 
      >   "NULL < field < const" SEL_ARG),  the special case when "const" 
      >   is NULL was not taken into account, so "NULL < field < NULL" 
      >   was produced for the "field < NULL" condition. 
      >    
      >   As a result, SEL_ARG structures of this form could not be 
      >   further optimized which in turn could lead to incorrectly 
      >   constructed SEL_ARG trees. In particular, code assuming SEL_ARG 
      >   structures to always form a sequence of ordered disjoint 
      >   intervals could enter an infinite loop under some 
      >   circumstances. 
      >    
      >   Fixed by changing get_mm_leaf() so that for any sargable 
      >   predicate except "<=>" involving NULL as a constant, "empty" 
      >   SEL_ARG is returned, since such a predicate is always false. 
      49383941
    • MySQL Build Team's avatar
      Backport into build-200911241145-5.1.40sp1 · edabd315
      MySQL Build Team authored
      > ------------------------------------------------------------
      > revno: 1810.3961.6
      > revision-id: joro@sun.com-20091030094044-quadg0bwjy7cwqzw
      > parent: joro@sun.com-20091029152429-ks55fhrp4lhknyij
      > committer: Georgi Kodinov <joro@sun.com>
      > branch nick: B48293-5.0-bugteam
      > timestamp: Fri 2009-10-30 11:40:44 +0200
      > message:
      >   Bug #48293: crash with procedure analyse, view with > 10 columns,
      >   having clause...
      >   
      >   The fix for bug 46184 was not very complete. It was not covering
      >   views using temporary tables and multiple tables in a FROM clause.
      >   Fixed by reverting the fix for 46184 and making a more general
      >   check that is checking at the right execution stage and for all
      >   of the non-supported cases.
      >   Now PROCEDURE ANALYZE on non-top level SELECT is also forbidden.
      >   Updated the analyse.test and subselect.test accordingly.
      edabd315