Commit graph

20 commits

Author SHA1 Message Date
Marko Mäkelä
37c14690fc Merge 10.4 into 10.5 2020-03-30 19:07:25 +03:00
Igor Babaev
caf110fa52 MDEV-21883 Server crashes when joining a subselect with 32 tables and GROUP BY
This bug could cause a crash for any query that used a derived table/view/CTE
whose specification was a SELECT with a GROUP BY clause and a FROM list
containing 32 or more table references.
The problem appeared only in the cases when the splitting optimization
could be applied to such derived table/view/CTE.
2020-03-23 19:21:57 -07:00
Sergei Golubchik
c1c5222cae cleanup: PSI key is *always* the first argument 2020-03-10 19:24:23 +01:00
Sergei Golubchik
7c58e97bf6 perfschema memory related instrumentation changes 2020-03-10 19:24:22 +01:00
Igor Babaev
8d7462ec49 MDEV-21614 Wrong query results with optimizer_switch="split_materialized=on"
Do not materialize a semi-join nest if it contains a materialized derived
table /view that potentially can be subject to the split optimization.
Splitting of materialization of such nest would help, but currently there
is no code to support this technique.
2020-02-07 19:48:35 -08:00
Igor Babaev
8f4de38f65 MDEV-18467 Server crashes in fix_semijoin_strategies_for_picked_join_order
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.
2019-03-04 23:11:18 -08:00
Igor Babaev
5ec144cfab MDEV-17211 Server crash on query
The function JOIN_TAB::choose_best_splitting() did not take into account
that for some tables whose fields were used in the GROUP BY list of
the specification of a splittable materialized derived there might exist
no elements in the array ext_keyuses_for_splitting.
2018-09-17 18:50:21 -07:00
Igor Babaev
c5a9a63293 MDEV-16917 Index affects query results
The optimizer erroneously allowed to use join cache when joining a
splittable materialized table together with splitting optimization.
As a consequence in some rare cases the server returned wrong result
sets for queries with materialized derived.

This patch allows to use either join cache without usage of splitting
technique for materialization of a splittable derived table or splitting
without usage of join cache when joining such table. The costs the these
alternatives are compared and the best variant is chosen.
2018-09-15 14:28:33 -07:00
Igor Babaev
d453374fc4 MDEV-16801 seg_fault on a query
The bug was in the in the code of JOIN::check_for_splittable_materialized()
where the structures describing the fields of a materialized derived
table that potentially could be used in split optimization were build.
As a result of this bug some fields that were not usable for splitting
were detected as usable. This could trigger crashes further in
st_join_table::choose_best_splitting().
2018-08-03 15:09:49 -07:00
Varun Gupta
724ab9a1cb MDEV-16057: Using optimization Splitting with Group BY we see an unnecessary attached condition
t1.pk IS NOT NULL where pk is a PRIMARY KEY

For equalites in the WHERE clause we create a keyuse array that contains the set of all equalities.
For each KEYUSE inside the keyuse array we have a field "null_rejecting"
which tells that the equality will not hold if either the left or right
hand side of the equality is NULL.
If the equality is NULL rejecting then we accordingly add a NOT NULL condition for the field present in
the item val(present in the KEYUSE struct) when we are doing ref access.

For the optimization of splitting with GROUP BY we always set the null_rejecting to TRUE and we are doing ref access on
the GROUP by field. This does create a problem when the equality is NOT NULL rejecting. This happens in this case as
in the equality we have the right hand side as t1.pk where pk is a PRIMARY KEY , hence it is NOT NULLABLE. So we should have
null rejecting set to FALSE for such a case.
2018-05-06 23:05:37 +05:30
Igor Babaev
cff60be7fe MDEV-15899 Server crashes in st_join_table::is_inner_table_of_outer_join
The crash happened because JOIN::check_for_splittable_materialized()
called by mistake the function JOIN_TAB::is_inner_table_of_outer_join()
instead of the function TABLE_LIST::is_inner_table_of_outer_join().
The former cannot be called before the call of make_outerjoin_info().
2018-04-17 23:39:40 -07:00
Michael Widenius
ddc5764303 Remove compiler warnings
- Remove unused variables
- Mark variables unused
- Fix wrong types
- Add no-strict-aliasing to BUILD scripts
2018-04-16 20:16:43 +03:00
Monty
75dd94c7ce Fixed compiler warnings
Remove compiler warnings in sphinx, item_sum.cc and opt_split.cc
2018-03-29 14:19:48 +03:00
Vladislav Vaintroub
6c279ad6a7 MDEV-15091 : Windows, 64bit: reenable and fix warning C4267 (conversion from 'size_t' to 'type', possible loss of data)
Handle string length as size_t, consistently (almost always:))
Change function prototypes to accept size_t, where in the past
ulong or uint were used. change local/member variables to size_t
when appropriate.

This fix excludes rocksdb, spider,spider, sphinx and connect for now.
2018-02-06 12:55:58 +00:00
Igor Babaev
7a9611aee2 Fixed MDEV-14994 Assertion `join->best_read < double(1.79...15e+308L)' or
server crash in JOIN::fix_all_splittings_in_plan

Cost formulas must take into account the case when a splittable table
has now rows.
2018-01-30 21:12:11 -08:00
Igor Babaev
775aa5542d Fixed mdev-15017 Server crashes in in st_join_table::fix_splitting
Do not apply splitting for constant tables.
2018-01-29 23:56:28 -08:00
Igor Babaev
c5ac1f953b Fixed mdev-14880: Assertion `inj_cond_list.elements' failed
in JOIN::inject_best_splitting_cond

The value of SplM_opt_info::last_plan should be set to NULL
before any search for a splitting plan for a splittable
materialized table.
2018-01-08 15:22:17 -08:00
Vladislav Vaintroub
7a01e64c3a Fix warnings 2018-01-06 22:11:42 +00:00
Igor Babaev
86cf60a615 Fixed mdev-14845 Server crashes in st_join_table::is_inner_table_of_outer_join
Do not try to apply the splitting optimization to a materialized
derived if it's specified by a select with impossible where
or if all joined tables of this select are constant.
2018-01-02 14:09:16 -08:00
Igor Babaev
4f0299f8b3 This is a full cost-based implementation of the optimization that employs
splitting technique for equi-joins of materialized derived tables/views/CTEs.
(see mdev-13369 and mdev-13389).
2017-12-30 12:29:09 -08:00