Commit graph

112 commits

Author SHA1 Message Date
Oleksandr Byelkin
e3982cead2 MDEV-6066: Merge new defaults from 5.6 and 5.7 (defaults changed, QC can be stopped with no-zero size) 2015-09-04 10:33:56 +02:00
Sergei Golubchik
5f510a9175 Merge branch '5.5' into 10.0 2015-03-06 18:41:32 +01:00
Sergei Golubchik
d7d19071d2 MDEV-6838 Using too big key for internal temp tables
update test results after the fix
2015-03-06 17:03:46 +01:00
Sergei Golubchik
7e29c1b539 5.5 merge 2014-09-16 14:03:17 +02:00
Sergei Golubchik
c799d65baf 5.3 merge 2014-09-12 16:51:41 +02:00
Igor Babaev
f735822720 Fixed bug mdev-5721.
Do not define a look-up key for a temporary table if its length
exceeds the maximum length of such keys.
2014-07-31 22:17:43 -07:00
unknown
4cd676cbd9 MDEV-6047: Make exists_to_in optimization ON by default 2014-06-09 13:42:21 +03:00
Sergei Golubchik
10740939eb 5.5 merge 2014-03-26 22:25:38 +01:00
Sergei Golubchik
5d8c15228e 5.3-merge 2014-03-16 19:21:37 +01:00
unknown
321ff25f3d MDEV-5740: Assertion `!derived->first_select()->exclude_from_table_unique_test || derived->outer_select()-> exclude_from_table_unique_test' failed on 2nd execution of PS with derived_merge
Do not check tables of executed units.
Debug info about stages of derived tables execution added.
2014-03-07 13:57:07 +02:00
Sergei Golubchik
0b9a0a3517 5.5 merge 2014-02-25 16:04:35 +01:00
Sergei Golubchik
ff2e82f4a1 5.3 merge 2014-02-22 22:51:20 +01:00
Igor Babaev
3e03c9eae9 After constant row substitution the optimizer should call the method
update_used_tables for the the where condition to update cached
indicators of constant subexpressions. It should be done before further
possible simplification of the where condition.

This change caused simplification of the executed where conditions 
in many test cases.
2014-02-20 21:27:33 -08:00
unknown
b0aaf5c6f5 Merge 5.3->5.5 2014-01-15 16:07:50 +02:00
Sergei Golubchik
59d9d08e2b 5.5 merge 2014-02-01 00:54:03 +01:00
unknown
57400ee681 MDEV-5414: RAND() in a subselect : different behavior in MariaDB and MySQL
Materialization forced in case if rand() used in view or derived table to avoud several calls of rand for gting value of a field.

Fixed set variable uncachable flag from - it shouldbe a side effect not a random value.
2013-12-18 15:59:51 +02:00
Sergei Golubchik
c6d30805db 5.5 merge 2013-11-23 00:50:54 +01:00
Sergei Golubchik
718c8c6044 5.3 merge 2013-11-15 10:06:23 +01:00
Igor Babaev
f8a6ee59ac Fixed bug mdev-5288.
This bug was a consequence of the incorrect fix for bug mdev-5091.
2013-11-14 13:25:05 -08:00
Sergey Petrunya
1e36cbfa39 MDEV-3798: [SHOW] EXPLAIN UPDATE/DELETE
- Merge with 10.0-base
2013-10-15 11:51:41 +04:00
Igor Babaev
ddc46740a5 Merge 5.5->10.0-base 2013-10-13 18:10:19 -07:00
Igor Babaev
c7db46a242 Merge 5.3-5.5 2013-10-13 13:43:29 -07:00
Igor Babaev
7c87385e30 Fixed bug mdev-5105.
The bug caused a memory overwrite in the function update_ref_and_keys()
It happened due to a wrong value of SELECT_LEX::cond_count. This value
historically was calculated by the fix_fields method. Now the logic of
calling this method became too complicated and, as a result, this value
is calculated not always correctly.
The patch changes the way how and when  the values of SELECT_LEX::cond_count
and of SELECT_LEX::between_count are calculated. The new code does it just at
the beginning of update_ref_and_keys().
2013-10-10 10:08:26 -07:00
Igor Babaev
ec226e553a Fixed bug mdev-5078.
For aggregated fields from views/derived tables the possible adjustment
of thd->lex->in_sum_func->max_arg_level in the function Item_field::fix_fields
must be done before we leave the function.
2013-10-04 09:51:07 -07:00
Sergey Petrunya
d2ea53aaed [SHOW] EXPLAIN UPDATE/DELETE, code re-architecting
- Pass more tests
- select with subselects is now shown with type=PRIMARY where it used to be (incorrectly) 'SIMPLE'
2013-06-18 10:57:36 +04:00
Sergei Golubchik
993ea79f2d 5.5 merge 2013-03-27 23:41:02 +01:00
Sergey Petrunya
1a998ee239 Merge 5.3->5.5 2013-03-01 11:44:10 +04:00
Igor Babaev
90c0f3d3ab Fixed bug mdev-4209
Do not include BLOB fields into the key to access the temporary
table created for a materialized view/derived table.
BLOB components are not allowed in keys.
2013-02-28 14:35:46 -08:00
unknown
e648ff111a MDEV-537 Make multi-column non-top level subqueries to be executed via index (index/unique subquery)
instead of single_select_engine

This task changes the IN-EXISTS rewrite for multi-column subqueries
"(a, b) IN (select b, c ...)" to work in the same way as for
single-column subqueries "a IN (select b ...) with respect to the
injection of NULL-rejecting predicates.
 
More specifically, the method
Item_in_subselect::create_row_in_to_exists_cond()
adds Item_is_not_null_test and Item_func_trig_cond only if the left
IN operand can be NULL. Not having these predicates when not necessary,
makes it possible to rewrite the subquery into a "unique_subquery" or
"index_subquery" when there is a suitable index on the only
subquery table.
2013-02-07 15:33:24 +02:00
Sergei Golubchik
aca8e7ed6b 5.3 merge 2013-01-15 19:07:46 +01:00
unknown
6f26aac940 MDEV-3873 & MDEV-3876 & MDEV-3912 : Wrong result (extra rows) with ALL subquery
from a MERGE view.

The problem was in the lost ability to be null for the table of a left join if it
is a view/derived table.

It hapenned because setup_table_map(), was called earlier then we merged
the view or derived.

Fixed by propagating new maybe_null flag during Item::update_used_tables().

Change in join_outer.test and join_outer_jcl6.test appeared because
IS NULL reported no used tables (i.e. constant) for argument which could not be
NULL and new maybe_null flag was propagated for IS NULL argument (Item_field)
because table the Item_field belonged to changed its maybe_null status.
2012-12-28 14:41:46 +02:00
Sergei Golubchik
68baf07dcd 5.3 merge 2012-10-18 23:33:06 +02:00
unknown
362c2bca3e Fix of MDEV-3799.
Find left table in right join (which turned to left join by reordering tables in join list but phisical order of tables of SELECT left as it was).
2012-10-10 22:42:50 +03:00
unknown
caedd1992c merge 5.3->5.5 2012-09-06 00:14:33 +03:00
unknown
54bb28d4a1 MDEV-486 LP BUG#1010116 fix.
Link view/derived table fields to a real table to check turning the table record to null row.

Item_direct_view_ref wrapper now checks if table is turned to null row.
2012-09-05 23:23:58 +03:00
Sergey Petrunya
8c762965d3 Merge 5.3 -> 5.5 2012-06-20 15:01:28 +04:00
Sergey Petrunya
584d923c32 Post-merge fixes:
- put back the result encoding in func_in.result (messed up by kdiff3)
- update .result for other tests (checked)
2012-06-20 13:41:31 +04:00
unknown
3d37b67b2b Fix for LP bug#998516
If we did nothing in resolving unique table conflict we should not retry (it leed to infinite loop).
Now we retry (recheck) unique table check only in case if we materialized a table.
2012-05-15 08:31:07 +03:00
Sergei Golubchik
1185420da0 5.3 merge 2012-05-21 20:54:41 +02:00
Sergei Golubchik
44cf9ee5f7 5.3 merge 2012-05-04 07:16:38 +02:00
unknown
9997b78ae4 LP BUG#978847 fixed.
Fixed incorrect type casting which made all fields (except very first) changes to materialized table incorrect.
Saved list of view/derived table used items after expanding '*'.
2012-04-19 09:16:30 +03:00
Sergei Golubchik
f860b2aad4 merge 2012-04-07 15:58:46 +02:00
unknown
1a48919036 Fix of LP bug#968720.
When a view/derived table is converted from merged to materialized the
items from the used_item lists are substituted for items referring to
the fields of the result of the materialization. The problem appeared
with queries employing natural joins. Since the resolution of a natural
join was performed only once the used_item list formed at the second
execution of the query lacked the references to the fields that were
used only in the equality predicates generated for the natural join.
2012-04-05 23:32:57 +03:00
Igor Babaev
5d954e7cd0 Merge 5.3->5.5 2012-03-17 01:26:58 -07:00
Igor Babaev
c1f5e25c04 Fixed LP bug #953649.
Do not call, directly or indirectly, SQL_SELECT::test_quick_select()
for derived materialized tables / views when optimizing joins referring
to these tables / views to get cost estimates of materialization.
The current code does not create B-tree indexes for materialized 
derived tables / views. So now it's not possible to get any estimates
for ranges conditions over the results of the materialization.

The function mysql_derived_create() must take into account the fact
that array of the KEY structures specifying the keys over a derived
table / view may be moved after the optimization phase if the
derived table / view  is materialized.
2012-03-13 13:34:20 -07:00
Sergei Golubchik
18c51eee35 5.3 merge 2012-03-06 20:46:07 +01:00
Igor Babaev
6f3c39a057 Fixed LP bug #944782.
This bug in the function JOIN::drop_unused_derived_keys() could
leave the internal structures for a materialized derived table
in an inconsistent state. This led to a not quite correct EXPLAIN
output when no additional key had been created to access the table.
It also may lead to more serious consequences: so, the test case
added with this fix caused a crash in mariadb-5.5.20.
2012-03-04 22:38:17 -08:00
Igor Babaev
8b469eb515 Merge 5.3->5.5. 2012-03-01 14:22:22 -08:00
Igor Babaev
841a74a4d6 Fixed LP bug #939009.
The result of materialization of the right part of an IN subquery predicate
is placed into a temporary table. Each row of the materialized table is
distinct. A unique key over all fields of the temporary table is defined and
created. It allows to perform key look-ups into the table.
The table created for a materialized subquery can be accessed by key as
any other table. The function best_access-path search for the best access
to join a table to a given partial join. With some where conditions this
function considers a possibility of a ref_or_null access. If such access
employs the unique key on the temporary table then when estimating
the cost this access the function tries to use the array rec_per_key. Yet,
such array is not built for this unique key. This causes a crash of the server.

Rows returned by the subquery that contain nulls don't have to be placed
into temporary table, as they cannot be match any row produced by the
left part of the subquery predicate. So all fields of the temporary table
can be defined as non-nullable. In this case any ref_or_null access
to the temporary table does not make any sense and it does not make sense
to estimate such an access.

The fix makes sure that the temporary table for a materialized IN subquery
is defined with columns that are all non-nullable. The also ensures that 
any row with nulls returned by the subquery is not placed into the
temporary table.
2012-02-24 16:50:22 -08:00
Sergei Golubchik
25609313ff 5.3.4 merge 2012-02-15 18:08:08 +01:00