| Bug #30330 | NOT IN faster than equals(=) | ||
|---|---|---|---|
| Submitted: | 9 Aug 2007 11:35 | Modified: | 27 Sep 2007 5:20 |
| Reporter: | Naveen JP | Email Updates: | |
| Status: | No Feedback | Impact on me: | |
| Category: | MySQL Server: Optimizer | Severity: | S5 (Performance) |
| Version: | 4.1.12-log | OS: | Linux (Gentoo) |
| Assigned to: | CPU Architecture: | Any | |
[9 Aug 2007 11:35]
Naveen JP
[9 Aug 2007 12:36]
Valeriy Kravchuk
Thank you for a problem report. Please, send complete explain results and SHOW CREATE TABLE results for all the tables involved.
[10 Aug 2007 9:07]
Naveen JP
More details including `show create table'
Attachment: FasterNotIn.sql (application/octet-stream, text), 10.71 KiB.
[10 Aug 2007 11:04]
Naveen JP
I found something that kind of "fixed" the problem. When I move the related conditions into a left outer join, the `NOT IN' or `equals(=)' did not vary in behavior. Given below is the change - select count(*) FROM applicant a, interview_setup ist left outer join companyinterview ci on ist.companyInterviewId = ci.id left outer join interviewmodel im on ci.InterviewModelId = im.Id WHERE a.modifiedTime > '2007-06-00' AND a.id = ist.intervieweeId AND im.Type = 'BISTR' --im.Type NOT IN( 'OVW','PRVW') ; Explain query does explain why, as the plans are same in both situations (with or without `NOT IN') - +----+-------------+-------+--------+---------------------------------------------------------+-----------------------------------+---------+-----------------------------------+--------+-------------+ | id | select_type | table | type | possible_keys | key | key_len | ref | rows | Extra | +----+-------------+-------+--------+---------------------------------------------------------+-----------------------------------+---------+-----------------------------------+--------+-------------+ | 1 | SIMPLE | a | ALL | PRIMARY | NULL | NULL | NULL | 305619 | Using where | | 1 | SIMPLE | ist | ref | unq_interview_setup_1,idx_interview_setup_intervieweeid | idx_interview_setup_intervieweeid | 4 | talentplus.a.Id | 1 | | | 1 | SIMPLE | ci | eq_ref | PRIMARY | PRIMARY | 4 | talentplus.ist.CompanyInterviewId | 1 | | | 1 | SIMPLE | im | eq_ref | PRIMARY,idx_interviewmodel_type | PRIMARY | 4 | talentplus.ci.InterviewModelId | 1 | Using where | +----+-------------+-------+--------+---------------------------------------------------------+-----------------------------------+---------+-----------------------------------+--------+-------------+
[27 Aug 2007 5:20]
Valeriy Kravchuk
Please, try to repeat with a newer version, 4.1.23, and inform about the results.
[27 Sep 2007 23:00]
Bugs System
No feedback was provided for this bug for over a month, so it is being suspended automatically. If you are able to provide the information that was originally requested, please do so and change the status of the bug back to "Open".
