Commit 80accb4
Ajo Robert
Bug#35842412 WHERE NOT IN with subquery is much slower on 8.1 than 5.7
Queries of the form SELECT DISTINCT..FROM t1 WHERE NOT IN(SELECT...)
would get transformed into an anti-join if possible, starting from 8.0+.
This made the optimizer not choose group skip scan for table "t1" which
otherwise, it would in 5.7 resulting in performance degradation for such
queries on 8.0+. Group skip scan is not chosen as the query is now no
more a single table query post the anti-join transformation and this
access method is enabled only for single table queries. The same
behaviour can be seen even for queries which are transformed into
semi-joins too. However, group skip scan access method could still be
picked for such queries if the access method is used only for duplicate
removal (i.e DISTINCT/GROUP BY without aggregation functions)
even in these cases.
Solution:
Enable group skip scan when there is only one table originally in the
query, irrespective of the number of semijoin tables present after
internal transformations and if the query doesn't contain aggregation
functions.
Change-Id: I8beb8996c1751b1ade4680582446760c2a24455f1 parent 71e50b4 commit 80accb4
File tree
12 files changed
+1257
-14
lines changed- mysql-test
- r
- suite/opt_trace/r
- t
- sql
- range_optimizer
12 files changed
+1257
-14
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
487 | 487 | | |
488 | 488 | | |
489 | 489 | | |
490 | | - | |
| 490 | + | |
491 | 491 | | |
492 | 492 | | |
493 | 493 | | |
494 | | - | |
| 494 | + | |
495 | 495 | | |
496 | 496 | | |
497 | 497 | | |
| |||
0 commit comments