summaryrefslogtreecommitdiff
path: root/mysql-test/t/subselect_mat.test
Commit message (Collapse)AuthorAgeFilesLines
* Fix bug lp:825095unknown2011-08-231-0/+28
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Analysis: Partial matching is used even when there are no NULLs in a materialized subquery, as long as the left NOT IN operand may contain NULL values. This case was not handled correctly in two different places. First, the implementation of parital matching did not clear the set of matching columns when the merge process advanced to the next row. Second, there is no need to perform partial matching at all when the left operand has no NULLs. Solution: First fix subselect_rowid_merge_engine::partial_match() to properly cleanup the bitmap of matching keys when advancing to the next row. Second, change subselect_partial_match_engine::exec() so that when the materialized subquery doesn't contain any NULLs, and the left operand of [NOT] IN doesn't contain NULLs either, the method returns without doing any unnecessary partial matching. The correct result in this case is in Item::in_value.
* Fixed LP bug #702301.Igor Babaev2011-07-201-0/+24
| | | | | | | The function matching_cond should take into account that there may be always false constant conjunctive conditions that has not been evaluated yet,for example, conjunctive conditions with non-correlated subqueries.
* Set the default to be mrr=off,mrr_sort_keys=off:Sergey Petrunya2011-07-081-0/+1
| | | | | | | - Set the default - Adjust the testcases so that 'new' tests are run with optimizations turned on. - Pull out relevant tests from "irrelevant" tests and run them with optimizations on. - Run range.test and innodb.test with both mrr=on and mrr=off
* Change the default @@optimizer_switch setting fromSergey Petrunya2011-07-051-1/+3
| | | | | | | | | | | | | | | semijoin=on,firstmatch=on,loosescan=on to semijoin=off,firstmatch=off,loosescan=off Adjust the testcases: - Modify subselect*.test and join_cache.test so that all tests use the same execution paths as before (i.e. optimizations that are being tested are enabled) - Let all other test files run with the new default settings (i.e. with new optimizations disabled) - Copy subquery testcases from these files into t/subselect_extra.test which will run them with new optimizations enabled.
* Merged the code of mwl 106 into the latest 5.3 with mwl 90 pushed.Igor Babaev2011-06-041-3/+3
|\ | | | | | | | | | | Resolved all conflicts and failures.
| * Merged the code of MWL#106 into 5.3Igor Babaev2011-05-161-3/+3
| |\ | | | | | | | | | | | | | | | | | | | | | | | | | | | Resolved all conflicts, bad merges and fixed a few minor bugs in the code. Commented out the queries from multi_update, view, subselect_sj, func_str, derived_view, view_grant that failed either with crashes in ps-protocol or with wrong results. The failures are clear indications of some bugs in the code and these bugs are to be fixed.
* | | Post-merge fixes part#2Sergey Petrunya2011-05-261-7/+0
| | |
* | | Merge MWL#90 with 5.3-mainSergey Petrunya2011-05-251-896/+32
|\ \ \ | |/ / |/| |
| * | Merge MWL#90 with main 5.3 treeSergey Petrunya2011-04-021-897/+32
| |\ \
| | * | BUG#724228: Wrong result with materialization=on and three aggregates in ↵Sergey Petrunya2011-03-011-0/+30
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | maria-5.3-mwl90 - In join buffering code, call join_tab_execution_startup() (#1) before we call join_tab_scan->open() (#2). This is important with SJ-Materialization because #1 fills the materialized table, while #2 will actually try to read the first row. Attempt to read the first row before we have populated the materialized table would cause zero rows to be returned when actually there were matches.
| | * | MWL#90: Subqueries: Inside-out execution for materialized non-sj subqueriesSergey Petrunya2011-02-151-897/+2
| | |\ \ | | | | | | | | | | | | | | | - Merge with 5.3 (3)
| | | * \ MWL#90: Subqueries: Inside-out execution for materialized non-sj subqueriesSergey Petrunya2010-12-091-897/+2
| | | |\ \ | | | | | | | | | | | | | | | | | | - Merge into 5.3-main
| | | | * | MWL#90: Subqueries: Inside-out execution for non-semijoin materialized ↵Sergey Petrunya2010-05-251-922/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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.
| | | | * | MWL#90: Subqueries: Inside-out execution for non-semijoin materialized ↵Sergey Petrunya2010-05-241-0/+9
| | | | |\ \ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | subqueries that are AND-parts of the WHERE - Merge into 5.3-subqueries
| | | | | * | MWL#90: Subqueries: Inside-out execution for non-semijoin materialized Sergey Petrunya2010-04-061-0/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | subqueries that are AND-parts of the WHERE - Make test results handle same-cost QEP races
| | | | | * | MWL#90: Subqueries: Inside-out execution for non-semijoin materializedSergey Petrunya2010-04-061-0/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | subqueries that are AND-parts of the WHERE - First code (needs cleanup).
| | | | * | | Fixed a problem where the temp table of a materialized subqueryunknown2010-04-061-0/+16
| | | | |/ / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | was not cleaned up between PS re-executions. The reason was two-fold: - a merge with mysql-6.0 missed select_union::cleanup() that should have cleaned up the temp table, and - the subclass of select_union used by materialization didn't call the base class cleanup() method.
* | | | | | MWL#89unknown2011-04-011-26/+33
|\ \ \ \ \ \ | |/ / / / / |/| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | - Auto-merge with 5.3 main. - Changed the test for LP BUG#719198 so that an two more queries were added, and removed a query that produces a wrong result due to an unrelated problem. The wrong result is submitted as a separate bug.
| * | | | | MWL#89unknown2011-03-301-22/+27
| |\ \ \ \ \ |/ / / / / / | | | | | | | | | | | | Merge 5.3 with 5.3-mwl89.
| * | | | | MWL#89unknown2011-03-011-20/+25
| |\ \ \ \ \ | | |/ / / / | |/| | | | | | | | | | | | | | | | | | | | | | Merge MWL#89 with 5.3.
| | * | | | Merge 5.3-mwl89 into 5.3.unknown2010-12-031-20/+25
| | |\ \ \ \ | | | |/ / / | | |/| | |
| | | * | | MWL#89: Cost-based choice between Materialization and IN->EXISTS transformationunknown2010-11-051-20/+25
| | | |\ \ \ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Merge 5.3-mwl89 into 5.3 main. There is one remaining test failure in this merge: innodb_mysql_lock2. All other tests have been checked to deliver the same results/explains as 5.3-mwl89, including the few remaining wrong results.
| | | | * | | MWL#89: Cost-based choice between Materialization and IN->EXISTS transformationunknown2010-10-201-20/+25
| | | | | |/ | | | | |/| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | - Added more tests to the MWL#89 specific test, and made the test more modular. - Updated test files. - Fixed a memory leak. - More comments. mysql-test/r/subselect_mat.result: - Updated the test file to reflect the new optimizer switches related to materialized subquery execution. - Added one extra test to test all cases that expose BUG#40037 (this is an old bug from 5.x). - Updated the test result with correct results that expose BUG#40037. mysql-test/t/subselect_mat.test: - Updated the test file to reflect the new optimizer switches related to materialized subquery execution. - Added one extra test to test all cases that expose BUG#40037 (this is an old bug from 5.x). - Updated the test result with correct results that expose BUG#40037. sql/sql_select.cc: Fixed a memory leak reported by Valgrind.
* | | | | | Fix LP BUG#719198, LP BUG#730604unknown2011-03-131-0/+52
|/ / / / / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Analysis (BUG#719198): The assert failed because the execution code for partial matching is designed with the assumption that NULLs on the left side are detected as early as possible, and a NULL result is returned before any lookups are performed at all. However, in the case of an Item_cache object on the left side, null was not detected properly, because detection was done via Item::is_null(), which is not implemented at all for Item_cache, and resolved to the default Item::is_null() which always returns FALSE. Solution: Imlpement Item::is_null(). ****** Analysis (BUG#730604): The method Item_field::is_null() determines if an item is NULL from its Item_field::field object. However, for Item_fields that represent internal temporary tables, Item_field::field represents the field of the original table that was the source for the temporary table (in this case t1.f3). Both in the committed test case, and in the original bug report the current value of t1.f3 is not NULL. This results in an incorrect count of NULLs for this column. As a consequence, all related Ordered_key buffers are allocated with incorrect sizes. Depending on the exact query and data, these incorrect sizes result in various crashes or failed asserts. Solution: The correct value of the current field of the internal temp table is in Item_field::result_field. This value is determined by Item::is_null_result().
* | | | | Testcase backport: BUG#46548 IN-subqueries return 0 rows with materialization=onSergey Petrunya2011-01-141-0/+23
|/ / / / | | | | | | | | | | | | (the bug itself was fixed during the subquery code backport)
* | | | Fix LP BUG#611622unknown2010-11-251-0/+45
|/ / / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Fix MySQL BUG#52344 - Subquery materialization: Assertion if subquery in on-clause of outer join Original fix and comments from Oysten, adjusted for the different subquery optimization in MariaDB. " Problem: If tables of an outer join are constant tables, the associated on-clause will be evaluated in the optimization phase. If the on-clause contains a query that is to be executed with subquery materialization, this will not work since the infrastructure for such execution is not yet set up. Solution: Do not evaluate on-clause in optimization phase if is_expensive() returns true for this clause. This is how the problem is currently avoided for where-clauses. This works because, Item_in_subselect::is_expensive_processor returns true if query is to be executed with subquery materialization. " In addition, after MWL#89, in MariaDB if the IN-EXISTS strategy is chosen, the in-to-exists predicates are insterted after join_read_const_table() is called, resulting in evaluation of the subquery without the in-to-exists predicates.
* | | Fixed LP bug #609121unknown2010-10-251-0/+22
|/ / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The bug was a result of missing logic to handle the case when there are 'expensive' predicates that are not evaluated during constant table optimization. Such is the case for the IN predicate, which is considered expensive if it is computed via materialization. In general this bug can be triggered with any expensive predicate instead of IN. When FALSE constant predicates are not evaluated during constant optimization, the execution path changes so that instead of setting JOIN::zero_result_cause after make_join_select, and exiting JOIN::exec via the call to return_zero_rows(), execution ends in JOIN::exec in the branch: if (join->tables == join->const_tables) { ... else if (join->send_row_on_empty_set()) ... rc= join->result->send_data(*columns_list); } Unlike return_zero_rows(), this branch didn't evaluate the having clause of the query. The patch adds a call to evaluate the HAVING clause of a query even when all tables are constant, because even for an empty result set some aggregate functions may produce a NULL value.
* | Fixed a problem where the temp table of a materialized subqueryunknown2010-07-161-0/+16
|/ | | | | | | | | was not cleaned up between PS re-executions. The reason was two-fold: - a merge with mysql-6.0 missed select_union::cleanup() that should have cleaned up the temp table, and - the subclass of select_union used by materialization didn't call the base class cleanup() method.
* BUG#45174: XOR in subqueries produces differing results in 5.1 and 5.4Sergey Petrunya2010-03-131-0/+16
| | | | | | | BUG#50019: Wrong result for IN-subquery with materialization - Fix equality substitution in presense of semi-join materialization, lookup and scan variants (started off from fix by Evgen Potemkin, then modified it to work in all cases)
* Backport of subquery optimizations to 5.3.Sergey Petrunya2010-01-171-0/+891
There are still test failures because of: - Wrong query results in outer join + semi join - EXPLAIN output differences