[MDEV-12172] Implement tables specified by table value constructors. Created: 2017-03-03 Updated: 2017-11-04 Resolved: 2017-11-04 |
|
| Status: | Closed |
| Project: | MariaDB Server |
| Component/s: | Optimizer |
| Fix Version/s: | 10.3.3 |
| Type: | Task | Priority: | Major |
| Reporter: | Igor Babaev | Assignee: | Igor Babaev |
| Resolution: | Fixed | Votes: | 0 |
| Labels: | gsoc17 | ||
| Issue Links: |
|
||||||||
| Sprint: | 10.3.3-1 | ||||||||
| Description |
|
SQL Standards starting from SQL-1999 uses the construct <table value constructor> as
Currently MariaDB uses <table value constructor> only in insert statements:
With <table value constructor> it will be possible to use such CTE specification:
Now instead of this we have to use something like this:
Processing of the latter will take much more memory. Besides with the possibility of using table value constructors in CTE specifications some optimization transformations for IN predicates will be possible. |
| Comments |
| Comment by Dinuka Nadeeshan [ 2017-03-21 ] | ||||||||||||||||||||||||||||||||||||||
|
hi, Thank you. | ||||||||||||||||||||||||||||||||||||||
| Comment by Igor Babaev [ 2017-03-28 ] | ||||||||||||||||||||||||||||||||||||||
|
Hi Dinuka, | ||||||||||||||||||||||||||||||||||||||
| Comment by Galina Shalygina (Inactive) [ 2017-06-30 ] | ||||||||||||||||||||||||||||||||||||||
|
First evaluation results: ( see the the list of commits here https://github.com/MariaDB/server/compare/10.3...shagalla:10.3-mdev12172 ) 1. New structure Table Value Constructor (TVC) was added in grammar so it can be used in such ways:
2. TVC was made as a class in new file sql_tvc.h (class table_value_constr). It was decided to start with the case when TVC is a part of UNION statement, so all forward statements are only for this case. 3. Link on TVC instance is stored in st_select_lex class. If TVC is recognised during parsing, new instance of st_select_lex is initialized with non-zero link on TVC. 4. sql_tvc.cc was created where table_value_constr::prepare and table_value_constr::exec are stored. 5. On prepare stage TVCs values types and names of columns of future temporary table where TVC will be stored are searched. As SQL Standard says nothing about how columns should be named it was decided to name them as elements of the first group of values of this TVC. 6. On execution stage TVCs values are sent to result using send_date method. 7. Now this example is working:
| ||||||||||||||||||||||||||||||||||||||
| Comment by Galina Shalygina (Inactive) [ 2017-07-26 ] | ||||||||||||||||||||||||||||||||||||||
|
Second evaluation results: ( see the the list of commits here https://github.com/MariaDB/server/compare/10.3...shagalla:10.3-mdev12172 ) Queries where TVC(s) are used are processed successfully. TVCs can be used separately as in:
with UNION/UNION ALL:
in derived tables:
views:
and non-recursive common table expressions:
|