Bug #73777 | DELETE query takes a long time and examines more rows than exist in the table | ||
---|---|---|---|
Submitted: | 31 Aug 2014 11:00 | Modified: | 1 Sep 2014 16:00 |
Reporter: | Paul Tumakaev | Email Updates: | |
Status: | Verified | Impact on me: | |
Category: | MySQL Server: Memory storage engine | Severity: | S3 (Non-critical) |
Version: | 5.6, 5.6.21, 5.5.40 | OS: | Linux |
Assigned to: | CPU Architecture: | Any |
[31 Aug 2014 11:00]
Paul Tumakaev
[31 Aug 2014 11:05]
Paul Tumakaev
Table dump
Attachment: db_test_table.sql.gz (application/x-gzip, text), 412.74 KiB.
[1 Sep 2014 9:44]
MySQL Verification Team
Testcase: ------------- drop table if exists t1; create table `t1` (`a` int,`b` int,`c` int, `d` int not null auto_increment, primary key (`d`), key (`c`,`a`) using btree) engine=memory; insert into t1(a,b,c) values (1,2,3),(3,2,1),(1,1,1),(2,2,2),(3,4,5); insert into t1(a,b,c) select a.a,a.b,a.c from t1 a,t1 b,t1 c,t1 d,t1 e,t1 f; truncate mysql.slow_log; flush status; set global slow_query_log=1; set session long_query_time=0; set global log_output='table'; delete from `t1` where `c`!=1 and `a`=2; set global slow_query_log=0; show status like '%handler%'; select * from mysql.slow_log\g
[1 Sep 2014 10:20]
MySQL Verification Team
Hello Paul, Thank you for the bug report. Verified as described. Thank you Shane for the simplified test case. Changing category to memory since Innodb/MyISAM doesn't have this issue. Thanks, Umesh
[1 Sep 2014 16:00]
Paul Tumakaev
On my server this bug repeats more than ten times a day. Is there ways to solve this problem by server configuration? Can I configure my server to kill requests, lasting more than 1 second? Thanks, Paul Tumakaev
[24 Aug 2015 13:24]
Mikle Johansson
Paul, try HASH index, it works for me