Bug #111414 | HASH JOIN results in wrong query results | ||
---|---|---|---|
Submitted: | 14 Jun 2023 9:26 | Modified: | 16 Jun 2023 9:32 |
Reporter: | yijun xie | Email Updates: | |
Status: | Can't repeat | Impact on me: | |
Category: | MySQL Server: Optimizer | Severity: | S3 (Non-critical) |
Version: | 8.0.33 | OS: | Any |
Assigned to: | CPU Architecture: | Any |
[14 Jun 2023 9:26]
yijun xie
[14 Jun 2023 9:28]
yijun xie
two table data
Attachment: testok_tbl_2_all_type2index.sql (application/octet-stream, text), 41.55 KiB.
[14 Jun 2023 9:29]
yijun xie
two table data
Attachment: test.rar (application/octet-stream, text), 6.02 KiB.
[14 Jun 2023 13:00]
MySQL Verification Team
Hi Mr. xie, Thank you for your bug report. However, we can not repeat it. We can not repeat your tests since we have got only the CREATE TABLE for tbl_2_all_type2index table. Please, upload also the SQL for tbl_1_all_type2index. Waiting for your feedback.
[15 Jun 2023 1:19]
yijun xie
two_table_data
Attachment: two_table_data.rar (application/octet-stream, text), 6.02 KiB.
[15 Jun 2023 1:28]
yijun xie
This file(two_table_data.rar) contains information for both tables。 The specific information of the file is as follows: [15 Jun 1:19] yijun xie two_table_data Attachment: two_table_data.rar (application/octet-stream, text), 6.02 KiB. You can get this file in the attachment.
[15 Jun 2023 12:45]
MySQL Verification Team
Hi Mr. xie, Sorry, but we can not use RAR format. Can you send us both CREATE TABLE in an .sql file ????
[15 Jun 2023 13:04]
yijun xie
table1
Attachment: testok_tbl_1_all_type2index.sql (application/octet-stream, text), 44.00 KiB.
[15 Jun 2023 13:05]
yijun xie
table
Attachment: testok_tbl_2_all_type2index.sql (application/octet-stream, text), 41.55 KiB.
[15 Jun 2023 13:05]
yijun xie
table2
Attachment: testok_tbl_2_all_type2index.sql (application/octet-stream, text), 41.55 KiB.
[15 Jun 2023 13:12]
yijun xie
First of all, I am very sorry for sending the rar file. Secondly, I sent the sql files of table1 and table2. But I accidentally sent table2 twice. You can just take table1 and table2.Looking forward to your reply.
[15 Jun 2023 13:41]
MySQL Verification Team
Hi Mr. xie, You have finally provided us with all that is needed. With the caveat that the names of the tables in your report are not the same as those in the dumps of the tables. However, with 8.0.33 we get the following results: +----------------------------+------+ | col1 | col4 | +----------------------------+------+ | 1000-01-01 00:00:00.000000 | 535 | | 1992-03-04 12:20:00.000000 | 0 | | 1995-09-02 13:20:00.000000 | 0 | | 1997-09-02 13:20:00.000000 | 0 | | 1999-09-02 13:20:00.000000 | 0 | | 2001-01-01 00:00:00.000000 | 535 | | 2001-02-01 00:00:00.000000 | 535 | | 2001-03-02 00:00:00.000000 | 535 | | 2001-04-06 00:00:00.000000 | 535 | | 2001-05-09 00:00:00.000000 | 535 | +----------------------------+------+ +----+-------------+-------+------------+-------+---------------+---------+---------+------+------+----------+---------------------------------+ | id | select_type | table | partitions | type | possible_keys | key | key_len | ref | rows | filtered | Extra | +----+-------------+-------+------------+-------+---------------+---------+---------+------+------+----------+---------------------------------+ | 1 | SIMPLE | a | NULL | ALL | NULL | NULL | NULL | NULL | 1 | 100.00 | Using temporary; Using filesort | | 1 | SIMPLE | b | NULL | index | NULL | PRIMARY | 4 | NULL | 1 | 100.00 | Using index | | 1 | SIMPLE | a | NULL | ALL | NULL | NULL | NULL | NULL | 1 | 100.00 | Using where; FirstMatch(b) | +----+-------------+-------+------------+-------+---------------+---------+---------+------+------+----------+---------------------------------+ +----------------------------+------+ | col1 | col4 | +----------------------------+------+ | 1000-01-01 00:00:00.000000 | 535 | | 1992-03-04 12:20:00.000000 | 0 | | 1995-09-02 13:20:00.000000 | 0 | | 1997-09-02 13:20:00.000000 | 0 | | 1999-09-02 13:20:00.000000 | 0 | | 2001-01-01 00:00:00.000000 | 535 | | 2001-02-01 00:00:00.000000 | 535 | | 2001-03-02 00:00:00.000000 | 535 | | 2001-04-06 00:00:00.000000 | 535 | | 2001-05-09 00:00:00.000000 | 535 | +----------------------------+------+ +----+--------------+-------------+------------+-------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+-------------------+---------+------+------+----------+--------------------------------------------+ | id | select_type | table | partitions | type | possible_keys | key | key_len | ref | rows | filtered | Extra | +----+--------------+-------------+------------+-------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+-------------------+---------+------+------+----------+--------------------------------------------+ | 1 | SIMPLE | a | NULL | ALL | ndx_id_datetime_col,ndx_int_datetime_col,ndx_decimal_datetime_col,ndx_float_datetime_col,ndx_datetime_timestamp_col,ndx_datetime_time_col,ndx_datetime_char_col,ndx_datetime_varchar_col | NULL | NULL | NULL | 5 | 100.00 | Using temporary; Using filesort | | 1 | SIMPLE | <subquery2> | NULL | ALL | NULL | NULL | NULL | NULL | NULL | 100.00 | Using where; Using join buffer (hash join) | | 1 | SIMPLE | b | NULL | index | NULL | ndx_id_bigint_col | 4 | NULL | 5 | 100.00 | Using index; Using join buffer (hash join) | | 2 | MATERIALIZED | a | NULL | ALL | ndx_bigint_char_col,ndx_char_varchar_col | NULL | NULL | NULL | 5 | 100.00 | NULL | +----+--------------+-------------+------------+-------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+-------------------+---------+------+------+----------+--------------------------------------------+ Results are identical , as you can see ....... EXPLAINs are different, because the other table has no indices !!!!! Do note that we used our own production binary, which can be obtained from dev.mysql.com. Can't repeat.
[16 Jun 2023 9:32]
yijun xie
Thank you for your reply. I installed version 8.0.33 of mysql, and I still found the problem about hash join. I am currently simplifying the operation steps to make the problem easier to reproduce.