Bug #111431 | condition_fanout_filter optimizer wrong result? | ||
---|---|---|---|
Submitted: | 15 Jun 2023 8:47 | Modified: | 15 Jun 2023 9:16 |
Reporter: | Pedro Ferreira | Email Updates: | |
Status: | Verified | Impact on me: | |
Category: | MySQL Server: Optimizer | Severity: | S3 (Non-critical) |
Version: | 8.0.33 | OS: | Ubuntu (22.04) |
Assigned to: | CPU Architecture: | Other (x86_64) | |
Tags: | Optimizer |
[15 Jun 2023 8:47]
Pedro Ferreira
[15 Jun 2023 9:16]
MySQL Verification Team
Hello Pedro Ferreira, Thank you for the report and feedback. Verified as described. regards, Umesh
[26 Jun 2023 14:48]
huahua xu
Hi Pedro Ferreira, The parameter `condition_fanout_filter` affected the choice of driver table which made by optimizer. For the case, You can use STRAIGHT_JOIN to avoid puting the tables in the wrong order by the join optimizer mysql> SET @@SESSION.OPTIMIZER_SWITCH = 'condition_fanout_filter=on'; mysql> SELECT c0 FROM (SELECT lag(t1.c1, 3) OVER () FROM t0 STRAIGHT_JOIN t1 ON t0.c0 = (t0.c0 DIV t0.c0)) t0 (c0) ORDER BY c0; +------+ | c0 | +------+ | NULL | | NULL | | NULL | | 1 | +------+ mysql> SET @@SESSION.OPTIMIZER_SWITCH = 'condition_fanout_filter=off'; mysql> SELECT c0 FROM (SELECT lag(t1.c1, 3) OVER () FROM t0 STRAIGHT_JOIN t1 ON t0.c0 = (t0.c0 DIV t0.c0)) t0 (c0) ORDER BY c0; +------+ | c0 | +------+ | NULL | | NULL | | NULL | | 1 | +------+ In addition, I do not think that it is a bug.