Bug #120809 Optimizer misses DISTINCT early-out and chooses 40M-row hash join Cartesian product
Submitted: 29 Jun 7:31 Modified: 2 Jul 14:07
Reporter: ZHAOYANG ZHANG Email Updates:
Status: Verified Impact on me:
None 
Category:MySQL Server: Optimizer Severity:S5 (Performance)
Version:9.7.1 and 8.0.31 OS:Ubuntu (22.04.4 LTS)
Assigned to: CPU Architecture:Any
Tags: distinct, firstmatch, hash join, JOIN_ORDER, Optimizer, performance, semijoin

File: Maximum allowed size is 50MB.
Description:
Privacy:

If the data you need to attach is more than 50MB, you should create a compressed archive of the data, split it to 50MB chunks, and upload each of them as a separate attachment.

To split a large file:

[29 Jun 7:32] ZHAOYANG ZHANG
Test case sql file

Attachment: mysql_distinct_earlyout.sql (application/octet-stream, text), 3.69 KiB.

[30 Jun 5:13] ZHAOYANG ZHANG
bug120809_distinct_earlyout_unused_table

Attachment: bug120809_distinct_earlyout_unused_table.sql (application/octet-stream, text), 4.06 KiB.