[MDEV-5123] Remove duplicated conditions pushed both to join_tab->select_cond and join_tab->cache_select->cond for blocked joins. Created: 2013-10-10 Updated: 2013-10-21 Due: 2013-10-15 Resolved: 2013-10-21 |
|
| Status: | Closed |
| Project: | MariaDB Server |
| Component/s: | None |
| Fix Version/s: | 10.0.5 |
| Type: | Task | Priority: | Major |
| Reporter: | Timour Katchaounov (Inactive) | Assignee: | Timour Katchaounov (Inactive) |
| Resolution: | Fixed | Votes: | 0 |
| Labels: | None | ||
| Attachments: |
|
||||||||
| Issue Links: |
|
||||||||
| Description |
|
If there is a condition that depends only on the second table in a blocked join, Currently the optimizer extracts such a single table condition independently from the generic condition pushdown. As a result the same condition may be evaluated up to two times more. This is a problem if the condition is expensive. It also makes it problematic to move the condition to an optimal partial join (see MDEV-83). |
| Comments |
| Comment by Timour Katchaounov (Inactive) [ 2013-10-10 ] |
|
"Generic" pushdown conditions are attached to specific joins via the member: JOIN_TAB::select_cond. Currently the extraction of these conditions happens in the following places in the optimizer: JOIN::optimize_inner calls:
|
| Comment by Timour Katchaounov (Inactive) [ 2013-10-10 ] |
|
Low-level design: 1. Split JOIN_TAB::select_cond into two conditions:
2. Instead of extracting the whole pushdown condition, make_join_select extracts the above two conditions. 3. The calls to make_scan_filter() will not extract the single table condition they used to. 4. In the end of make_join_read_info set the final pushdown condition to: |
| Comment by Sergei Petrunia [ 2013-10-14 ] |
|
So, after this task, instead of extracting one condition: table_n_cond = make_cond_for_table(....) we will always extract two: table_n_cond_for_table = ... and will then use table_n_cond_for_table AND table_n_select_cond this approach may cause a problem: "table_n_cond" is not always the same as "table_n_cond_for_table AND table_n_select_cond" |
| Comment by Timour Katchaounov (Inactive) [ 2013-10-14 ] |
|
The attached diff implements the above incomplete idea. |
| Comment by Timour Katchaounov (Inactive) [ 2013-10-15 ] |
|
The task will be implemented according the following idea porposed by Sergey Petrunia: for each top-level AND-item in select_cond These conjuncts can be removed from select_cond because they are false |
| Comment by Sergei Petrunia [ 2013-10-17 ] |
|
Had a review discussion on the latest variant of the patch. Approved, after requested changes are implemented. |
| Comment by Timour Katchaounov (Inactive) [ 2013-10-18 ] |
|
The task is pushed to 5.5-timour (because this is my only tree that runs under buildbot).
|
| Comment by Timour Katchaounov (Inactive) [ 2013-10-21 ] |
|