summaryrefslogtreecommitdiff
path: root/sql/sql_select.h
Commit message (Collapse)AuthorAgeFilesLines
...
| | * | | MDEV-4536, MDEV-4042Sergey Petrunya2013-07-151-0/+6
| | | | | | | | | | | | | | | | | | | | | | | | | - Make JOIN::cleanup(true) also work correctly when the query is KILLed after join optimization was started but before a query plan was produced
| | * | | -Run test suite with smaller aria keybuffer size (to make it possible to run ↵Michael Widenius2013-06-051-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | more tests in parallel) -Added test and extra code to ensure we don't leave keyread on for a handler table. -Create on disk temporary files always with long data pointers if SQL_SMALL_RESULT is not used. This ensures that we can handle temporary files bigger than 4G. mysql-test/include/default_mysqld.cnf: Run test suite with smaller aria keybuffer size mysql-test/suite/maria/maria3.result: Run test suite with smaller aria keybuffer size mysql-test/suite/sys_vars/r/aria_pagecache_buffer_size_basic.result: Run test suite with smaller aria keybuffer size sql/handler.cc: Disable key read (extra safety if something went wrong) sql/multi_range_read.cc: Ensure we have don't leave keyread on for secondary_file sql/opt_range.cc: Simplify code with mark_columns_used_by_index_no_reset() Ensure that read_keys_and_merge() disableds keyread if it enables it sql/opt_subselect.cc: Remove not anymore used argument for create_internal_tmp_table() sql/sql_derived.cc: Remove not anymore used argument for create_internal_tmp_table() sql/sql_select.cc: Use 'enable_keyread()' instead of calling HA_EXTRA_RESET. (Makes debugging easier) Create on disk temporary files always with long data pointers if SQL_SMALL_RESULT is not used. This ensures that we can handle temporary files bigger than 4G. Remove not anymore used argument for create_internal_tmp_table() More DBUG sql/sql_select.h: Remove not anymore used argument for create_internal_tmp_table()
* | | | | Merge 10.0-base -> 10.0Igor Babaev2013-04-221-0/+13
|\ \ \ \ \ | |/ / / /
| * | | | MDEV-4345unknown2013-04-181-0/+13
| | | | | | | | | | | | | | | | | | | | Sampling of selectivity of LIKE predicate.
* | | | | Merge 10.0-base -> 10.0Igor Babaev2013-04-171-0/+8
|\ \ \ \ \ | |/ / / /
| * | | | Added comments.Igor Babaev2013-04-151-2/+4
| | | | | | | | | | | | | | | | | | | | | | | | | Renamed the virtual method middle_point_pos for the class Field to pos_in_interval.
| * | | | Merge 10.0-base -> mwl253.Igor Babaev2013-03-311-3/+19
| |\ \ \ \
| * | | | | The pilot patch for mwl#253.Igor Babaev2013-03-111-0/+6
| | |_|_|/ | |/| | |
* | | | | 10.0-base mergeSergei Golubchik2013-04-151-3/+19
|\ \ \ \ \ | | |/ / / | |/| | |
| * | | | 5.5 mergeSergei Golubchik2013-03-271-3/+19
| |\ \ \ \ | | |/ / / | |/| / / | | |/ /
| | * | 5.3->5.5 mergeSergei Golubchik2013-02-281-1/+17
| | |\ \ | | | |/
| | | * Fixed bug mdev-3995.Igor Babaev2013-02-071-0/+17
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This bug happened because the executor tried to use a wrong TABLE REF object when building access keys. It constructed keys from fields of a materialized table from a ref object created to construct keys from the fields of the underlying base table. This could happen only when materialized table was created for a non-correlated IN subquery and only when the materialized table used for lookups. In this case we are guaranteed to be able to construct the keys from the fields of tables that would be outer tables for the tables of the IN subquery. The patch makes sure that no ref objects constructed from fields of materialized lookup tables are to be used.
| | * | merge with mysql-5.5.30 minus few incorrect or not applicable changesetsSergei Golubchik2013-02-281-2/+2
| | |\ \
| | | * | Fix for Bug#14636211 WRONG RESULT (EXTRA ROW) ON A FROM SUBQUERY Olav Sandstaa2013-01-151-1/+15
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | WITH A VARIABLE AND ORDER BY Bug#16035412 MYSQL SERVER 5.5.29 WRONG SORTING USING COMPLEX INDEX This is a fix for a regression introduced by Bug#12667154: Bug#12667154 attempted to fix a performance problem with subqueries that did filesort. For doing filesort, the optimizer creates a quick select object to use when building the sort index. This quick select object was deleted after the first call to create_sort_index(). Thus, for queries where the subquery was executed multiple times, the quick object was only used for the first execution. For all later executions of the subquery, filesort used a complete table scan for building the sort index. The fix for Bug#12667154 tried to fix this by not deleting the quick object after the first execution of create_sort_index() so that it would be re-used for building the sort index by the following executions of the subquery. This regression introduced in Bug#12667154 is that due to not deleting the quick select object after building the sort index, the quick object could in some cases be used also during the second phase of the execution of the subquery instead of using the created sort index. This caused wrong results to be returned. The fix for this issue is to delete the reference to the select object after it has been used in create_sort_index(). In this way the select and quick objects will not be available when doing the second phase of the execution of the select operation. To ensure that the select object can be re-used for the following executions of the subquery we make a copy of the select pointer. This is used for restoring the select object after the select operation is completed. mysql-test/suite/innodb/r/innodb_mysql.result: Changed explain output: The explain now contains "Using where" since we have restored the select pointer after doing the filesort operation. sql/sql_select.cc: Change create_sort_index() so that it always sets the pointer to the select object to NULL. This is done in order to avoid that the select->quick object can be used when execution the main part of the select operation. sql/sql_select.h: New member in JOIN_TAB: saved_select. Used by create_sort_index to make a backup copy of the select pointer.
* | | | | Merge MariaDB 10.0-base to MariaDB 10.0unknown2012-12-181-9/+11
|\ \ \ \ \ | |/ / / /
| * | | | Merge mariadb-5.5 -> 10.0-base.Igor Babaev2012-12-161-9/+12
| |\ \ \ \ | | |/ / /
| | * | | Fix of MDEV-3874: Server crashes in Item_field::print on a SELECT from a ↵unknown2012-11-261-0/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | MERGE view with materialization+semijoin, subquery, ORDER BY. The problem was that in debugging binaries it try to print item to assign human readable name to the item. But subquery item was already freed (join_free/cleanup with full cleanup) so Item_field refers to temporary table which memory had been already freed.
* | | | | MDEV-3858 Change JOIN_TAB::records_read from ha_rows to doubleunknown2012-11-151-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Currently JOIN_TAB::records_read is of type ha_rows. This is an integer type, which prevents proper selectivity and rows estimates.
* | | | | Merge 5.5 -> 10.0-sergSergey Petrunya2012-11-041-0/+1
|\ \ \ \ \ | | |/ / / | |/| | |
| * | | | MDEV-536: LP:1050806 - different result for a query using subquery, andSergey Petrunya2012-11-041-0/+10
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | MDEV-567: Wrong result from a query with correlated subquery if ICP is allowed: backport the fix developed for SHOW EXPLAIN: revision-id: psergey@askmonty.org-20120719115219-212cxmm6qvf0wlrb branch nick: 5.5-show-explain-r21 timestamp: Thu 2012-07-19 15:52:19 +0400 BUG#992942 & MDEV-325: Pre-liminary commit for testing and adjust it so that it handles DS-MRR scans correctly.
| * | | | MDEV-3812unknown2012-10-271-13/+15
| | | | | | | | | | | | | | | | | | | | This patch undoes the removal of enum store_key_result by the previous patch for mdev-3812.
| * | | | MDEV-3812: Remove unneeded extra call to engine->exec() in ↵unknown2012-10-251-15/+13
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Item_subselect::exec, remove enum store_key_result This task fixes an ineffeciency that is a remainder from MySQL 5.0/5.1. There, subqueries were optimized in a lazy manner, when executed for the first time. During this lazy optimization it may happen that the server finds a more efficient subquery engine, and substitute the current engine of the query being executed with the new engine. This required re-execution of the engine. MariaDB 5.3 pre-optimizes subqueries in almost all cases, and the engine is chosen in most cases, except when subquery materialization found that it must use partial matching. In this case, the current code was performing one extra re-execution although it was not needed at all. The patch performs the re-execution only if the engine was changed while executing. In addition the patch performs small cleanup by removing "enum store_key_result" because it is essentially a boolean, and the code that uses it already maps it to a boolean.
* | | | | 10.0-base -> 10.0-montySergei Golubchik2012-10-191-1/+48
|\ \ \ \ \ | | |/ / / | |/| | |
| * | | | SHOW EXPLAIN: merge with 5.5-mainSergey Petrunya2012-10-061-1/+35
| |\ \ \ \ | | |/ / / | |/| | |
| | * | | Merge 5.5-main -> 5.5-show-explainSergey Petrunya2012-07-251-0/+3
| | |\ \ \
| | * | | | BUG#992942 & MDEV-325: Pre-liminary commit for testingSergey Petrunya2012-07-191-0/+10
| | | | | |
| | * | | | MWL#182: Explain running statementsSergey Petrunya2012-06-151-0/+38
| | |\ \ \ \ | | | | | | | | | | | | | | | | | | | | | - Merge with current 5.5-main
| | | * | | | MDEV-305: SHOW EXPLAIN: ref returned by SHOW EXPLAIN is different from the ↵Sergey Petrunya2012-06-041-0/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | normal EXPLAIN ('const' vs empty string) - The problem was that create_ref_for_key() would act differently, depending on whether we're running EXPLAIN or the actual query. - As the first step, fixed the EXPLAIN printout not to depend on actions in create_ref_for_key().
| | | * | | | Merge of recent changes in MWL#182 in 5.3 with {Merge of MWL#182 with 5.5}Sergey Petrunya2012-05-171-2/+21
| | | |\ \ \ \
| | | | * | | | MDEV-240: SHOW EXPLAIN: Assertion `this->optimized == 2' failedSergey Petrunya2012-05-111-2/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | - Fix the bug: SHOW EXPLAIN may hit a case where a join is partially optimized. - Change JOIN::optimized to use enum instead of numeric constants
| | | | * | | | # MDEV-239: Assertion `field_types == 0 ... ' failed in Protocol_text::store...Sergey Petrunya2012-05-101-1/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | - Make all functions that produce parts of EXPLAIN output take explain_flags as parameter, instead of looking into thd->lex->describe
| | | | * | | | MDEV-238: SHOW EXPLAIN: Server crashes in JOIN::print_explain with FROM ↵Sergey Petrunya2012-05-101-0/+14
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | subquery and GROUP BY - Support SHOW EXPLAIN for selects that have "Using temporary; Using filesort".
| | | | * | | | MWL#182: Explain running statements: merge with 5.3-mainSergey Petrunya2012-04-131-1/+10
| | | | |\ \ \ \
| | | * | \ \ \ \ MWL#182: SHOW EXPLAIN: Merge 5.3->5.5Sergey Petrunya2012-05-161-1/+13
| | | |\ \ \ \ \ \
| | | | * | | | | | Apply earlier patch: correct handling of subqueries that Sergey Petrunya2012-01-041-1/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | were not yet optimized or already executed and deleted.
| | | | * | | | | | MWL#182: Explain running statements: merge with 5.3-main (needs fixing)Sergey Petrunya2012-01-031-1/+10
| | | | |\ \ \ \ \ \ | | | | | | |/ / / / | | | | | |/| | | |
| | | | | * | | | | MWL#182: Explain running statementsSergey Petrunya2011-10-271-1/+10
| | | | | |\ \ \ \ \ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | - Merge with 5.3-main
| | | | | | * | | | | Fix SHOW EXPLAIN for UNIONs.Sergey Petrunya2011-10-271-0/+3
| | | | | | | | | | |
| | | | | | * | | | | MWL#182: Explain running statementsSergey Petrunya2011-08-241-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | - Further progress with the code - Testcases.
| | | | | | * | | | | MWL#182: Explain running statementsSergey Petrunya2011-08-231-1/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | First code - "Asynchronous procedure call" system - new THD::check_killed() that serves APC request is called from within most important loops - EXPLAIN code is now able to generate EXPLAIN output on-the-fly [incomplete] Parts that are still missing: - put THD::check_killed() call into every loop where we could spend significant amount of time - Make sure EXPLAIN code works for group-by queries that replace JOIN::join_tab with make_simple_join() and other such cases. - User interface: what error code to use, where to get timeout settings from, etc.
| * | | | | | | | | | MDEV-414 Depending on indexes or execution plans, a warning on incorrect or ↵Sergei Golubchik2012-08-311-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | out of range values in WHERE condition is sometimes produced and sometimes not use the same method that disables warnings in all relevant places, remove redundant function
| * | | | | | | | | | Fix bug mdev-447: Wrong output from the EXPLAIN command of the test case for ↵unknown2012-08-211-0/+13
| | |_|_|_|_|_|/ / / | |/| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | lp bug #714999 The fix backports from MWL#182: Explain running statements the logic that saves the original JOIN_TAB array of a query plan after optimization. This array is later used during EXPLAIN to iterate over the original JOIN plan nodes in the cases when this plan could be changed by early subquery execution during the optimization phase of the outer query.
* | | | | | | | | | fixes for test failuresSergei Golubchik2012-09-271-15/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | and small collateral changes mysql-test/lib/My/Test.pm: somehow with "print" we get truncated writes sometimes mysql-test/suite/perfschema/r/digest_table_full.result: md5 hashes of statement digests differ, because yacc token codes are different in mariadb mysql-test/suite/perfschema/r/dml_handler.result: host table is not ported over yet mysql-test/suite/perfschema/r/information_schema.result: host table is not ported over yet mysql-test/suite/perfschema/r/nesting.result: this differs, because we don't rewrite general log queries, and multi-statement packets are logged as a one entry. this result file is identical to what mysql-5.6.5 produces with the --log-raw option. mysql-test/suite/perfschema/r/relaylog.result: MariaDB modifies the binlog index file directly, while MySQL 5.6 has a feature "crash-safe binlog index" and modifies a special "crash-safe" shadow copy of the index file and then moves it over. That's why this test shows "NONE" index file writes in MySQL and "MANY" in MariaDB. mysql-test/suite/perfschema/r/server_init.result: MariaDB initializes the "manager" resources from the "manager" thread, and starts this thread only when --flush-time is not 0. MySQL 5.6 initializes "manager" resources unconditionally on server startup. mysql-test/suite/perfschema/r/stage_mdl_global.result: this differs, because MariaDB disables query cache when query_cache_size=0. MySQL does not do that, and this causes useless mutex locks and waits. mysql-test/suite/perfschema/r/statement_digest.result: md5 hashes of statement digests differ, because yacc token codes are different in mariadb mysql-test/suite/perfschema/r/statement_digest_consumers.result: md5 hashes of statement digests differ, because yacc token codes are different in mariadb mysql-test/suite/perfschema/r/statement_digest_long_query.result: md5 hashes of statement digests differ, because yacc token codes are different in mariadb mysql-test/suite/rpl/r/rpl_mixed_drop_create_temp_table.result: will be updated to match 5.6 when alfranio.correia@oracle.com-20110512172919-c1b5kmum4h52g0ni and anders.song@greatopensource.com-20110105052107-zoab0bsf5a6xxk2y are merged mysql-test/suite/rpl/r/rpl_non_direct_mixed_mixing_engines.result: will be updated to match 5.6 when anders.song@greatopensource.com-20110105052107-zoab0bsf5a6xxk2y is merged
* | | | | | | | | | Temporary commit of merge of MariaDB 10.0-base and MySQL 5.6Michael Widenius2012-08-011-1/+1
|/ / / / / / / / /
* | | | | | | | | Merge the fix for lp:944706, mdev-193unknown2012-06-061-0/+3
|\ \ \ \ \ \ \ \ \ | |/ / / / / / / / |/| | | | | | | |
| * | | | | | | | Fix for bug lp:944706, task MDEV-193unknown2012-05-171-0/+3
| |/ / / / / / / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The patch enables back constant subquery execution during query optimization after it was disabled during the development of MWL#89 (cost-based choice of IN-TO-EXISTS vs MATERIALIZATION). The main idea is that constant subqueries are allowed to be executed during optimization if their execution is not expensive. The approach is as follows: - Constant subqueries are recursively optimized in the beginning of JOIN::optimize of the outer query. This is done by the new method JOIN::optimize_constant_subqueries(). This is done so that the cost of executing these queries can be estimated. - Optimization of the outer query proceeds normally. During this phase the optimizer may request execution of non-expensive constant subqueries. Each place where the optimizer may potentially execute an expensive expression is guarded with the predicate Item::is_expensive(). - The implementation of Item_subselect::is_expensive has been extended to use the number of examined rows (estimated by the optimizer) as a way to determine whether the subquery is expensive or not. - The new system variable "expensive_subquery_limit" controls how many examined rows are considered to be not expensive. The default is 100. In addition, multiple changes were needed to make this solution work in the light of the changes made by MWL#89. These changes were needed to fix various crashes and wrong results, and legacy bugs discovered during development.
* | | | | | | | 5.3 mergeSergei Golubchik2012-05-211-1/+13
|\ \ \ \ \ \ \ \ | |/ / / / / / / |/| | | | | | / | | |_|_|_|_|/ | |/| | | | |
| * | | | | | Fix compiler warnings.unknown2012-05-081-1/+1
| | | | | | |
| * | | | | | Addition to the fix to LP bug#994275.unknown2012-05-081-1/+13
| | | | | | | | | | | | | | | | | | | | | | | | | | | | It is problem of constant propagated to ref* access method (the problem was hiden by using debug binaries for testing).
* | | | | | | 5.3 mergeSergei Golubchik2012-05-041-1/+2
|\ \ \ \ \ \ \ | |/ / / / / /