[MDEV-7586] Merged derived tables/VIEWs increment created_tmp_tables Created: 2015-02-14 Updated: 2015-03-06 Resolved: 2015-03-04 |
|
| Status: | Closed |
| Project: | MariaDB Server |
| Component/s: | Optimizer |
| Affects Version/s: | 5.3.12, 10.0.17, 5.5, 10.0 |
| Fix Version/s: | 10.0.18 |
| Type: | Bug | Priority: | Critical |
| Reporter: | Sergei Petrunia | Assignee: | Vicențiu Ciorbaru |
| Resolution: | Fixed | Votes: | 0 |
| Labels: | optimizer | ||
| Issue Links: |
|
||||||||||||||||
| Description |
|
When derived tables or VIEWs are resolved with subquery merge, they still Example:
To be sure it's merged, let's check the query plan:
The same thing happens when using a derived table:
|
| Comments |
| Comment by Sergei Petrunia [ 2015-02-14 ] |
|
Code-wise the problem happens when create_tmp_table() is called with the parameter do_not_open=true. We create a temporary but we don't open it. The problems with this are
|
| Comment by Sergei Petrunia [ 2015-02-14 ] |
|
MySQL 5.6.20 and MySQL 5.6.10 do not have this problem. |
| Comment by Sergei Petrunia [ 2015-02-14 ] |
|
|
| Comment by Sergei Petrunia [ 2015-02-14 ] |
|
Need to discuss this with igor. |
| Comment by Sergei Petrunia [ 2015-02-19 ] |
|
Discussion notes: 2. Need to check out where the do_not_open=true code comes from. |
| Comment by Sergei Petrunia [ 2015-02-19 ] |
|
cvicentiu, can you make a patch that does #1 ? |
| Comment by Sergei Petrunia [ 2015-02-19 ] |
|
Checked where do_not_open parameter of create_tmp_table() comes from. it was introduced by this revision: igor@askmonty.org-20100526201818-en2jqo1p1t3hi3ra |
| Comment by Vicențiu Ciorbaru [ 2015-02-22 ] |
|
According to the documented code: This flag gets set in 2 places: To me, it makes sense to increase the status variable whenever this flag change occurs. create_tmp_table with do_not_open that does not have a subsequent open_tmp_table call:
|
| Comment by Vicențiu Ciorbaru [ 2015-02-22 ] |
|
There is also an extra prototype of create_internal_tmp_table with a my_bool big_tables argument. There is no implementation or call to this function in the code anywhere, thus I've removed it. |
| Comment by Sergei Petrunia [ 2015-03-04 ] |
|
The part about possible slowdown is branched off into MDEV-7662. |