[MDEV-7486] Condition pushdown from HAVING into WHERE Created: 2015-01-21 Updated: 2019-03-22 Resolved: 2019-02-24 |
|
| Status: | Closed |
| Project: | MariaDB Server |
| Component/s: | Optimizer |
| Fix Version/s: | 10.4.3 |
| Type: | Task | Priority: | Major |
| Reporter: | Sergei Petrunia | Assignee: | Galina Shalygina (Inactive) |
| Resolution: | Fixed | Votes: | 1 |
| Labels: | Compatibility | ||
| Issue Links: |
|
||||||||||||||||||||||||||||||||||||||||||||||||
| Epic Link: | Oracle Compatibility | ||||||||||||||||||||||||||||||||||||||||||||||||
| Description |
|
Consider a query
Here, cond1(col) can be pushed down from HAVING into WHERE clause. cond2(agg_func(..)) cannot be pushed down. Basically, we can push down conditions that remain constant across the GROUP BY groups. Pushdown allows to filter out the whole groups. This task is about
|
| Comments |
| Comment by Sergei Petrunia [ 2015-12-01 ] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
See also https://mariadb.com/kb/en/mariadb/moving-from-oracle-to-mariadb/#comment_1839 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Sergei Petrunia [ 2018-03-07 ] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Note that despite
An example that shows HAVING->WHERE pushdown is not happening:
An example shows that if one uses derived table, pushdown will happen:
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Igor Babaev [ 2019-02-24 ] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Patches for this task was pushed into 10.4 |