summaryrefslogtreecommitdiff
path: root/sql/sql_select.h
Commit message (Collapse)AuthorAgeFilesLines
* Merge commit 'c05e571e7d53ba11a3422490cff0d93e6691ea62' into HEAD10.5-mergeSergei Golubchik2020-10-291-2/+1
|\
* | MDEV-23825 Join select_handler and Pushdown_select + XPand changesAlexander Barkov2020-09-271-23/+0
| |
* | Merge 10.4 into 10.5Marko Mäkelä2020-08-101-0/+2
|\ \ | |/
| * Merge 10.3 into 10.4Marko Mäkelä2020-08-101-0/+2
| |\
| | * Merge 10.2 into 10.3Marko Mäkelä2020-08-101-0/+2
| | |\
| | | * MDEV-17066: Bytes lost or Assertion `status_var.local_memory_used == 0 after ↵Varun Gupta2020-08-051-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | DELETE with subquery with ROLLUP The issue here is when records are read from the temporary file (filesort result in this case) via a cache(rr_from_cache). The cache is initialized with init_rr_cache. For correlated subquery the cache allocation is happening at each execution of the subquery but the deallocation happens only once and that was when the query execution was done. So generally for subqueries we do two types of cleanup 1) Full cleanup: we should free all resources of the query(like temp tables). This is done generally when the query execution is complete or the subquery re-execution is not needed (case with uncorrelated subquery) 2) Partial cleanup: Minor cleanup that is required if the subquery needs recalculation. This is done for all the structures that need to be allocated for each execution (example SORT_INFO for filesort is allocated for each execution of the correlated subquery). The fix here would be free the cache used by rr_from_cache in the partial cleanup phase.
* | | | MDEV-22399: Remove multiple calls to enable and disable Handler::keyread and ↵Varun Gupta2020-06-101-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | perform it after the plan refinement phase is done Introduce a function to enable keyreads for indexes and use this function when all the decision of plan refinement phase are done.
* | | | Merge 10.4 into 10.5Marko Mäkelä2020-05-311-1/+3
|\ \ \ \ | |/ / /
| * | | Merge 10.3 into 10.4Marko Mäkelä2020-05-261-1/+3
| |\ \ \ | | |/ /
| | * | Merge 10.2 into 10.3Marko Mäkelä2020-05-251-1/+3
| | |\ \ | | | |/
| | | * MDEV-22461: JOIN::make_aggr_tables_info(): Assertion `select_options & (1ULL ↵Varun Gupta2020-05-251-1/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | << 17)' failed. A temporary table is needed for window function computation but if only a NAMED WINDOW SPEC is used and there is no window function, then there is no need to create a temporary table as there is no stage to compute WINDOW FUNCTION
* | | | Merge 10.4 into 10.5Marko Mäkelä2020-03-301-1/+4
|\ \ \ \ | |/ / /
| * | | Merge 10.3 into 10.4Marko Mäkelä2020-03-301-1/+4
| |\ \ \ | | |/ /
| | * | Merge 10.2 into 10.3Marko Mäkelä2020-03-301-1/+4
| | |\ \ | | | |/
| | | * MDEV-22006 runtime error: null pointer passed as argument 2, which is ↵Eugene Kosov2020-03-231-1/+4
| | | | | | | | | | | | | | | | | | | | | | | | declared to never be null in JOIN::copy_ref_ptr_array() Do not memcpy() a zero-length buffer
* | | | perfschema table io instrumentation related changesSergei Golubchik2020-03-101-0/+2
| | | |
* | | | perfschema memory related instrumentation changesSergei Golubchik2020-03-101-1/+1
| | | |
* | | | perfschema - various collateral cleanups and small changesSergei Golubchik2020-03-101-3/+3
| | | |
* | | | Merge 10.4 into 10.5Marko Mäkelä2019-12-271-0/+1
|\ \ \ \ | |/ / /
| * | | Merge 10.3 into 10.4Marko Mäkelä2019-12-271-0/+1
| |\ \ \ | | |/ /
| | * | Merge 10.2 into 10.3Marko Mäkelä2019-12-271-0/+1
| | |\ \ | | | |/
| | | * MDEV-21318: Wrong results with window functions and implicit groupingVarun Gupta2019-12-261-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The issue here is for degenerate joins we should execute the window function but it is not getting executed in all the cases. To get the window function values window function needs to be executed always. This currently does not happen in few cases where the join would return 0 or 1 row like 1) IMPOSSIBLE WHERE 2) MIN/MAX optimization 3) EMPTY CONST TABLE The fix is to make sure that window functions get executed and the temporary table is setup for the execution of window functions
* | | | cleanup: don't pass wild_num to setup_wild()Sergei Golubchik2019-10-141-6/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | because internally setup_wild() adjusts select_lex->with_wild directly anyway, so there is no reason to pretend that the number of '*' may be anything else but select_lex->with_wild And don't update select_lex->item_list, because fields can come from anywhere and don't necessarily have to be copied into select_lex.
* | | | Merge 10.4 into 10.5Marko Mäkelä2019-09-241-1/+7
|\ \ \ \ | |/ / /
| * | | Merge 10.3 into 10.4Marko Mäkelä2019-09-231-1/+7
| |\ \ \ | | |/ / | | | | | | | | Disable MDEV-20576 assertions until MDEV-20595 has been fixed.
| | * | Merge 10.2 into 10.3Marko Mäkelä2019-09-231-1/+7
| | |\ \ | | | |/
| | | * MDEV-20371: Invalid reads at plan refinement stage: join->positions...Sergei Petrunia2019-09-111-1/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | best_access_path() is called from two optimization phases: 1. Plan choice phase, in choose_plan(). Here, the join prefix being considered is in join->positions[] 2. Plan refinement stage, in fix_semijoin_strategies_for_picked_join_order Here, the join prefix is in join->best_positions[] It used to access join->positions[] from stage #2. This didnt cause any valgrind or asan failures (as join->positions[] has been written-to before) but the effect was similar to that of reading the random data: The join prefix we've picked (in join->best_positions) could have nothing in common with the join prefix that was last to be considered (in join->positions).
* | | | Merge 10.4 into 10.5Marko Mäkelä2019-09-061-1/+1
|\ \ \ \ | |/ / /
| * | | Merge 10.3 into 10.4, except for MDEV-20265Marko Mäkelä2019-08-231-1/+1
| |\ \ \ | | |/ / | | | | | | | | | | | | | | | | | | | | | | | | The MDEV-20265 commit e746f451d57def4be679caafc29976741b3e89f7 introduces DBUG_ASSERT(right_op == r_tbl) in st_select_lex::add_cross_joined_table(), and that assertion would fail in several tests that exercise joins. That commit was skipped in this merge, and a separate fix of MDEV-20265 will be necessary in 10.4.
| | * | MDEV-19740 Debug build of 10.3.15 FTBFSAleksey Midenkov2019-08-191-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | * Replace LINT_INIT for non-struct types with ctor initializers; * Check BUILD_DEPS list is not empty so REMOVE_DUPLICATES won't throw error.
* | | | MDEV-15777 Use inferred IS NOT NULL predicates in the range optimizerIgor Babaev2019-08-301-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch introduces the optimization that allows range optimizer to consider index range scans that are built employing NOT NULL predicates inferred from WHERE conditions and ON expressions. The patch adds a new optimizer switch not_null_range_scan.
* | | | Revert "MDEV-20342 Turn Field::flags from a member to a method"Alexander Barkov2019-08-141-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | This reverts commit e86010f909fb6b8c4ffd9d6df92991ac079e67e7. Reverting on Monty's request, as this change makes merging things from 10.5 to 10.2 much harder.
* | | | MDEV-20342 Turn Field::flags from a member to a methodAlexander Barkov2019-08-141-2/+2
| | | |
* | | | MDEV-19593 Split create_schema_table() into virtual methods in Type_handlerAlexander Barkov2019-05-251-0/+7
|/ / /
* | | Merge branch '10.3' into 10.4Oleksandr Byelkin2019-05-191-1/+1
|\ \ \ | |/ /
| * | Merge 10.2 into 10.3Marko Mäkelä2019-05-141-1/+1
| |\ \ | | |/
| | * Merge 10.1 into 10.2Marko Mäkelä2019-05-131-1/+1
| | |\
| | | * Merge branch '5.5' into 10.1Vicențiu Ciorbaru2019-05-111-1/+1
| | | |\
| | | | * Update FSF AddressVicențiu Ciorbaru2019-05-111-1/+1
| | | | | | | | | | | | | | | | | | | | * Update wrong zip-code
* | | | | MDEV-18769 Assertion `fixed == 1' failed in Item_cond_or::val_intGalina Shalygina2019-04-041-2/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This bug is caused by pushdown from HAVING into WHERE. It appears because condition that is pushed wasn't fixed. It is also discovered that condition pushdown from HAVING into WHERE is done wrong. There is no need to build clones for some conditions that can be pushed. They can be simply moved from HAVING into WHERE without cloning. build_pushable_cond_for_having_pushdown(), remove_pushed_top_conjuncts_for_having() methods are changed. It is found that there is no transformation made for fields of pushed condition. field_transformer_for_having_pushdown transformer is added. New tests are added. Some comments are changed.
* | | | | Merge 10.3 into 10.4Marko Mäkelä2019-03-201-3/+2
|\ \ \ \ \ | |/ / / / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The MDEV-17262 commit 26432e49d37a37d09b862bb49a021e44bdf4789c was skipped. In Galera 4, the implementation would seem to require changes to the streaming replication. In the tests archive.rnd_pos main.profiling, disable_ps_protocol for SHOW STATUS and SHOW PROFILE commands until MDEV-18974 has been fixed.
| * | | | Merge branch '10.2' into 10.3Sergei Golubchik2019-03-171-3/+2
| |\ \ \ \ | | |/ / /
| | * | | post-merge: gcc 8 warningsSergei Golubchik2019-03-151-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | note: Inherit String from Sql_alloc, to get operators new and new[] in sync in rocksdb gcc was complaining that non-lvalue was cast to const.
| | * | | Merge branch '10.1' into 10.2Sergei Golubchik2019-03-151-1/+0
| | |\ \ \ | | | |/ /
| | | * | fix gcc 8 compiler warningsSergei Golubchik2019-03-141-1/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | There were two newly enabled warnings: 1. cast for a function pointers. Affected sql_analyse.h, mi_write.c and ma_write.cc, mf_iocache-t.cc, mysqlbinlog.cc, encryption.cc, etc 2. memcpy/memset of nontrivial structures. Fixed as: * the warning disabled for InnoDB * TABLE, TABLE_SHARE, and TABLE_LIST got a new method reset() which does the bzero(), which is safe for these classes, but any other bzero() will still cause a warning * Table_scope_and_contents_source_st uses `TABLE_LIST *` (trivial) instead of `SQL_I_List<TABLE_LIST>` (not trivial) so it's safe to bzero now. * added casts in debug_sync.cc and sql_select.cc (for JOIN) * move assignment method for MDL_request instead of memcpy() * PARTIAL_INDEX_INTERSECT_INFO::init() instead of bzero() * remove constructor from READ_RECORD() to make it trivial * replace some memcpy() with c++ copy assignments
* | | | | Merge 10.3 into 10.4Marko Mäkelä2019-03-061-1/+2
|\ \ \ \ \ | |/ / / /
| * | | | MDEV-18467 Server crashes in fix_semijoin_strategies_for_picked_join_orderIgor Babaev2019-03-041-1/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | If a splittable materialized derived table / view T is used in a inner nest of an outer join with impossible ON condition then T is marked as a constant table. Yet the execution plan to build T is still searched for in spite of the fact that is not needed. So it should be set.
* | | | | MDEV-7486: Condition pushdown from HAVING into WHEREGalina Shalygina2019-02-171-1/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Condition can be pushed from the HAVING clause into the WHERE clause if it depends only on the fields that are used in the GROUP BY list or depends on the fields that are equal to grouping fields. Aggregate functions can't be pushed down. How the pushdown is performed on the example: SELECT t1.a,MAX(t1.b) FROM t1 GROUP BY t1.a HAVING (t1.a>2) AND (MAX(c)>12); => SELECT t1.a,MAX(t1.b) FROM t1 WHERE (t1.a>2) GROUP BY t1.a HAVING (MAX(c)>12); The implementation scheme: 1. Extract the most restrictive condition cond from the HAVING clause of the select that depends only on the fields that are used in the GROUP BY list of the select (directly or indirectly through equalities) 2. Save cond as a condition that can be pushed into the WHERE clause of the select 3. Remove cond from the HAVING clause if it is possible The optimization is implemented in the function st_select_lex::pushdown_from_having_into_where(). New test file having_cond_pushdown.test is created.
* | | | | Merge branch '10.4' into bb-10.4-mdev16188Igor Babaev2019-02-141-1/+45
|\ \ \ \ \
| * \ \ \ \ Merge branch '10.4' into bb-10.4-mdev17096Igor Babaev2019-02-061-2/+6
| |\ \ \ \ \