Commit graph

2358 commits

Author SHA1 Message Date
Aleksey Midenkov
84b718ae70 SQL: derived SYSTEM_TIME clash detection [closes #371] 2017-12-08 16:26:17 +03:00
Aleksey Midenkov
6e0b2c7fe0 System Versioning 1.0pre2
Merge branch '10.3' into trunk
2017-11-23 19:41:44 +03:00
Michael Widenius
8a24be6e74 Less dependencies in include files 2017-11-23 09:49:45 +02:00
Michael Widenius
87933d5261 Handle failures from malloc
Most "new" failures fixed in the following files:
- sql_select.cc
- item.cc
- item_func.cc
- opt_subselect.cc

Other things:
- Allocate udf_handler strings in mem_root
  - Required changes in sql_string.h
- Add mem_root as argument to some new [] calls
- Mark udf_handler strings as thread specific
- Removed some comment blocks with code
2017-11-17 07:30:05 +02:00
Aleksey Midenkov
497c6add88 System Versioning pre1.0
Merge branch '10.3' into trunk
2017-11-13 19:09:46 +03:00
Aleksey Midenkov
d8d7251019 System Versioning pre0.12
Merge remote-tracking branch 'origin/archive/2017-10-17' into 10.3
2017-11-07 00:37:49 +03:00
Monty
0750b5f825 Fixed compilation failures
- Also added missing copyright notices
2017-11-02 11:06:02 +02:00
Igor Babaev
6f1b6061d8 Merge remote-tracking branch 'shagalla/10.3-mdev12172' into 10.3
As a result of this merge the code for the following tasks appears in 10.3:
- MDEV-12172 Implement tables specified by table value constructors
- MDEV-12176 Transform [NOT] IN predicate with long list of values INTO
             [NOT] IN subquery.
2017-11-01 21:42:26 -07:00
Alexander Barkov
835cbbcc7b Merge remote-tracking branch 'origin/bb-10.2-ext' into 10.3
TODO: enable MDEV-13049 optimization for 10.3
2017-10-30 20:47:39 +04:00
Alexander Barkov
003cb2f424 Merge remote-tracking branch 'origin/10.2' into bb-10.2-ext 2017-10-30 16:42:46 +04:00
Galina Shalygina
a4ded0a9b5 Mistakes corrected.
TVC can be used in IN subquery and in PARTITION BY struct now.
Special variable to control working of optimization added.
2017-10-28 20:54:18 +02:00
Alexander Barkov
5dd5253f7e MDEV-14139 Anchored data types for variables 2017-10-27 20:48:16 +04:00
Sergei Golubchik
e0a1c745ec Merge branch '10.1' into 10.2 2017-10-24 14:53:18 +02:00
Sergei Golubchik
9d2e2d7533 Merge branch '10.0' into 10.1 2017-10-22 13:03:41 +02:00
Sergei Golubchik
da4503e956 Merge branch '5.5' into 10.0 2017-10-18 15:14:39 +02:00
Alexander Barkov
30e7d6709f Merge remote-tracking branch 'origin/10.2' into bb-10.2-ext 2017-10-18 14:11:55 +04:00
Oleksandr Byelkin
235b68299b MDEV-9619: Assertion `null_ref_table' failed in virtual table_map Item_direct_view_ref::used_tables() const on 2nd execution of PS
Refer left expression indirectly in case it changes from execution to execution.
2017-10-13 19:32:38 +02:00
Igor Babaev
4c9d19ee65 Fixed the bug mdev-13796.
A reference to a CTE may occur not in the master of the CTE
specification. In this case if the reference to the CTE is
the first one the specification should be detached from its
master and attached to the referencing select.

Also fixed the TYPE column in the lines of the EXPLAIN output
created for CTE tables.
2017-10-11 10:22:46 -07:00
halfspawn
34f36a335b MDEV-14012 - sql_mode=Oracle: substr(): treat position 0 as position 1 2017-10-06 09:23:06 +02:00
Alexander Barkov
67eb1252ac Merge remote-tracking branch 'origin/bb-10.2-ext' into 10.3 2017-09-28 18:56:15 +04:00
Alexander Barkov
d387bc89ed MDEV-13907 compoind.test fails in build-bot for bb-10.2-ext 2017-09-26 08:03:08 +04:00
Marko Mäkelä
4a32e2395e Merge bb-10.2-ext into 10.3 2017-09-25 22:05:56 +03:00
Alexander Barkov
840f1310cb Fixing a few -Wconversion warnings 2017-09-23 15:48:47 +04:00
Eugene Kosov
d176be8aea remove dead code (#450)
* remove dead code

* rename method to reduce confusion
2017-09-20 16:07:06 +04:00
Eugene Kosov
7e4a3c29e1 remove dead code 2017-09-19 21:24:29 +04:00
Galina Shalygina
6bce8e1422 Post review changes for the optimization of IN predicates into IN subqueries. 2017-09-02 23:19:20 +02:00
Galina Shalygina
570d2e7d0f Summarized results of two previous commits (26 July, 25 August) 2017-08-29 02:32:39 +02:00
Michael Widenius
4aaa38d26e Enusure that my_global.h is included first
- Added sql/mariadb.h file that should be included first by files in sql
  directory, if sql_plugin.h is not used (sql_plugin.h adds SHOW variables
  that must be done before my_global.h is included)
- Removed a lot of include my_global.h from include files
- Removed include's of some files that my_global.h automatically includes
- Removed duplicated include's of my_sys.h
- Replaced include my_config.h with my_global.h
2017-08-24 01:05:44 +02:00
Alexander Barkov
d258a2bd1f Merge remote-tracking branch 'origin/bb-10.2-ext' into 10.3 2017-08-22 20:27:10 +04:00
Igor Babaev
d7b45e01b4 This patch complements the patch for mdev-10855.
It allows to push conditions into derived with window functions not
only in the cases when the window specifications of these window
functions use the same partition, but also in the cases when the window
functions use partitions that share only some fields. In these
cases only the conditions over the common fields are pushed.
2017-08-19 15:02:29 -07:00
Alexander Barkov
6ac3d7511c Merge remote-tracking branch 'origin/bb-10.2-ext' into 10.3 2017-08-15 17:13:59 +04:00
Alexander Barkov
966cc80299 MDEV-13528 Add LEX::sp_body_finalize_{procedure|function} 2017-08-15 11:15:18 +04:00
Alexander Barkov
6db1b0188c Merge remote-tracking branch 'origin/bb-10.2-ext' into 10.3 2017-08-15 07:52:48 +04:00
Igor Babaev
61bbabb202 Implemented condition pushdown into derived tables / views
with window functions (mdev-10855).

This patch just modified the function pushdown_cond_for_derived()
to support this feature.
Some test cases demonstrating this optimization were added to
derived_cond_pushdown.test.
2017-08-12 19:58:55 -07:00
halfspawn
c9981fbee2 MDEV-13003 - Oracle compatibility : Replace function 2017-08-11 14:47:36 +04:00
Igor Babaev
b14e2b044b This first patch prepared for the task MDEV-13369:
"Optimization for equi-joins of derived tables with GROUP BY"
should be considered rather as a 'proof of concept'.

The task itself is targeted at an optimization that employs re-writing
equi-joins with grouping derived tables / views into lateral
derived tables. Here's an example of such transformation:
  select t1.a,t.max,t.min
  from t1 [left] join
       (select a, max(t2.b) max, min(t2.b) min from t2
       group by t2.a) as t
       on t1.a=t.a;
=>
  select t1.a,tl.max,tl.min
  from t1 [left] join
       lateral (select a, max(t2.b) max, min(t2.b) min from t2
                where  t1.a=t2.a) as t
       on 1=1;
The transformation pushes the equi-join condition t1.a=t.a into the
derived table making it dependent on table t1. It means that for
every row from t1 a new derived table must be filled out. However
the size of any of these derived tables is just a fraction of the
original derived table t. One could say that transformation 'splits'
the rows used for the GROUP BY operation into separate groups
performing aggregation for a group only in the case when there is
a match for the current row of t1.
Apparently the transformation may produce a query with a better
performance only in the case when
 - the GROUP BY list refers only to fields returned by the derived table
 - there is an index I on one of the tables T used in FROM list of
   the specification of the derived table whose prefix covers the
   the fields from the proper beginning of the GROUP BY list or
   fields that are equal to those fields.
Whether the result of the re-writing can be executed faster depends
on many factors:
  - the size of the original derived table
  - the size of the table T
  - whether the index I is clustering for table T
  - whether the index I fully covers the GROUP BY list.

This patch only tries to improve the chosen execution plan using
this transformation. It tries to do it only when the chosen
plan reaches the derived table by a key whose prefix covers
all the fields of the derived table produced by the fields of
the table T from the GROUP BY list.
The code of the patch does not evaluates the cost of the improved
plan. If certain conditions are met the transformation is applied.
2017-08-10 14:26:29 -07:00
Marko Mäkelä
620ba97cfc Merge remote-tracking branch 'origin/bb-10.2-ext' into 10.3 2017-08-09 12:59:39 +03:00
Aleksey Midenkov
d3d2ea9fd5 SQL, Parser: system_time logic and syntax fixes [closes #237] 2017-08-08 17:12:16 +03:00
Alexander Barkov
0f1cadd9a5 MDEV-13450 Cleanup SP code for packages 2017-08-04 16:33:58 +04:00
Alexander Barkov
c431eafd62 Merge remote-tracking branch 'origin/bb-10.2-ext' into 10.3 2017-07-31 23:00:59 +04:00
Alexander Barkov
c9218ff439 MDEV-13415 Wrap the code in sp.cc into a class Sp_handler 2017-07-31 23:00:02 +04:00
Alexander Barkov
4937474f86 MDEV-13414 Fix the SP code to avoid excessive use of strlen 2017-07-31 17:34:59 +04:00
Alexander Barkov
e33bda183e Merge remote-tracking branch 'origin/bb-10.2-ext' into 10.3 2017-07-12 12:00:11 +04:00
Alexander Barkov
7c3df72d0a MDEV-13298 Change sp_head::m_chistics from a pointer to a structure 2017-07-12 11:57:47 +04:00
Alexander Barkov
3b9273d203 Merge remote-tracking branch 'origin/bb-10.2-ext' into 10.3 2017-07-05 17:43:32 +04:00
Alexander Barkov
96d1cdecbe MDEV-13197 Parser refactoring for CREATE VIEW,TRIGGER,SP,UDF,EVENT 2017-07-01 14:37:12 +04:00
Galina Shalygina
615da8f70b New structure Table Value Constructor added in grammar.
TVC can be used in UNION-statement, in view and in subquery.

Files where TVC is defined and its methods are stored added.
Methods exec and prepare for TVC added.
Tests for TVC added.
2017-06-29 15:36:07 +03:00
Marko Mäkelä
176000a54c Merge bb-10.2-ext into 10.3 2017-06-27 08:14:45 +03:00
Marko Mäkelä
43c77bb937 Merge 10.2 into bb-10.2-ext 2017-06-27 08:13:59 +03:00
Igor Babaev
9f3622191d Fixed the bug mdev-12845.
This patch fills in a serious flaw in the
code that supports condition pushdown into
materialized views / derived tables.

If a predicate happened to contain a reference
to a mergeable view / derived table and it does
not depended directly on the target materialized
view / derived table then the predicate was not
considered as a subject to pusdown to this view
/ derived table.
2017-06-22 22:06:03 -07:00