Bug #97302 | Force Hash Joins even if index is available | ||
---|---|---|---|
Submitted: | 20 Oct 2019 17:17 | Modified: | 21 Oct 2019 14:43 |
Reporter: | Tibor Korocz | Email Updates: | |
Status: | Verified | Impact on me: | |
Category: | MySQL Server: Optimizer | Severity: | S4 (Feature request) |
Version: | 8.0 | OS: | Any |
Assigned to: | CPU Architecture: | Any |
[20 Oct 2019 17:17]
Tibor Korocz
[21 Oct 2019 7:30]
MySQL Verification Team
Hello Tibor Korocz, Thank you for the feature request! regards, Umesh
[21 Oct 2019 14:43]
Tibor Korocz
Hi, Some extra informations, I was able to force the optimiser to use Hash Joins even if an index is available by using ignore index: mysql> explain format=tree select count(*) from t1 ignore index (idx_c2) join t2 ignore index (idx_c2) on t1.c2 = t2.c2 where t1.c2=t2.c2\G *************************** 1. row *************************** EXPLAIN: -> Aggregate: count(0) -> Inner hash join (t2.c2 = t1.c2) (cost=1728502115.04 rows=17336898) -> Table scan on t2 (cost=0.00 rows=131472) -> Hash -> Table scan on t1 (cost=13219.45 rows=131472) 1 row in set (0.00 sec) I still think would be nice if I can tell to the optimiser with a hint to use Hash Joins even if an index is available, so we do not have to ignore indexes on all the tables manually.