Bug #46525 | 5.1.36: innodb: updates / alter table exremley slow | ||
---|---|---|---|
Submitted: | 3 Aug 2009 10:16 | Modified: | 12 Jul 2010 15:29 |
Reporter: | Harald Reindl | Email Updates: | |
Status: | Can't repeat | Impact on me: | |
Category: | MySQL Server: InnoDB storage engine | Severity: | S5 (Performance) |
Version: | OS: | Linux | |
Assigned to: | CPU Architecture: | Any |
[3 Aug 2009 10:16]
Harald Reindl
[3 Aug 2009 10:37]
Valeriy Kravchuk
Thank you for the problem report. Please, send the result of: explain select * from dbmail_messages where deleted_flag=1 and status!=3; Also please run your slow update and send the results of SHOW INNODB STATUS\G immediately after that.
[3 Aug 2009 11:06]
Harald Reindl
explain, innodb status, mysqltuner....
Attachment: bug_summary.txt (text/plain), 10.72 KiB.
[17 Aug 2009 8:50]
Susanne Ebrecht
How did you upgrade? Did you re-create all indexes on your InnoDB tables?
[17 Aug 2009 9:01]
Harald Reindl
I used "mysql_upgrade -u root -p" twice, the scond time with force But this also affects tables which are dropped and created new because we were in dbmail-evaluation and wanted to get rid of the test data We are using innodb_per_table, so i think after drop-create there should be no problems with old data-formats
[4 Sep 2009 12:10]
Harald Reindl
Same with 5.1.38 and innodb-Plugin instead of builtin I try to compress some inno-tables on the backup-machine (replication-slave) and see that there are locks which are the real problem, if the table would not be locked while alter this would not hurt so much because it could compress a week in background How comes with "innodb_table_locks = 0"? 6866 | Locked | INSERT INTO dbmail_datefield (physmessage_id, datefield).... 773 | copy to tmp table | alter table dbmail_datefield ROW_FORMAT=COMPRESSED
[19 Nov 2009 7:16]
Valeriy Kravchuk
Please, send the results of: show create table dbmail_messages\G show table status like 'dbmail_messages'\G I see that update scans entire table (and lock every row as a result)...
[19 Nov 2009 16:24]
Harald Reindl
Thank you for your reply Here the two outputs from our backup-machine (vmware machine) This one has a small innodb_buffer_pool, but even with bigger or uncompressed tables it's all the same mysql> show table status like 'dbmail_messages'; +-----------------+--------+---------+------------+--------+----------------+-------------+-----------------+--------------+-----------+----------------+---------------------+-------------+------------+-----------------+----------+-----------------------+---------+ | Name | Engine | Version | Row_format | Rows | Avg_row_length | Data_length | Max_data_length | Index_length | Data_free | Auto_increment | Create_time | Update_time | Check_time | Collation | Checksum | Create_options | Comment | +-----------------+--------+---------+------------+--------+----------------+-------------+-----------------+--------------+-----------+----------------+---------------------+-------------+------------+-----------------+----------+-----------------------+---------+ | dbmail_messages | InnoDB | 10 | Compressed | 101924 | 125 | 12812288 | 0 | 29720576 | 2097152 | 762415 | 2009-09-13 05:22:16 | NULL | NULL | utf8_general_ci | NULL | row_format=COMPRESSED | | +-----------------+--------+---------+------------+--------+----------------+-------------+-----------------+--------------+-----------+----------------+---------------------+-------------+------------+-----------------+----------+-----------------------+---------+ 1 row in set (1.27 sec) dbmail_messages | CREATE TABLE `dbmail_messages` ( `message_idnr` bigint(20) unsigned NOT NULL AUTO_INCREMENT, `mailbox_idnr` bigint(10) unsigned NOT NULL DEFAULT '0', `physmessage_id` bigint(20) unsigned NOT NULL DEFAULT '0', `seen_flag` tinyint(3) unsigned NOT NULL DEFAULT '0', `answered_flag` tinyint(3) unsigned NOT NULL DEFAULT '0', `deleted_flag` tinyint(3) unsigned NOT NULL DEFAULT '0', `flagged_flag` tinyint(3) unsigned NOT NULL DEFAULT '0', `recent_flag` tinyint(3) unsigned NOT NULL DEFAULT '0', `draft_flag` tinyint(3) unsigned NOT NULL DEFAULT '0', `unique_id` varchar(70) NOT NULL DEFAULT '', `status` tinyint(3) unsigned NOT NULL DEFAULT '0', PRIMARY KEY (`message_idnr`), KEY `physmessage_id_index` (`physmessage_id`), KEY `mailbox_idnr_index` (`mailbox_idnr`), KEY `seen_flag_index` (`seen_flag`), KEY `unique_id_index` (`unique_id`), KEY `status_index` (`status`), KEY `mailbox_status` (`mailbox_idnr`,`status`), KEY `deleted_flag_index` (`deleted_flag`), CONSTRAINT `dbmail_messages_ibfk_1` FOREIGN KEY (`physmessage_id`) REFERENCES `dbmail_physmessage` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT `dbmail_messages_ibfk_2` FOREIGN KEY (`mailbox_idnr`) REFERENCES `dbmail_mailboxes` (`mailbox_idnr`) ON DELETE CASCADE ON UPDATE CASCADE ) ENGINE=InnoDB AUTO_INCREMENT=762415 DEFAULT CHARSET=utf8 ROW_FORMAT=COMPRESSED
[19 Nov 2009 16:26]
Harald Reindl
Thats the result after the query has finsihed Database changed mysql> update `dbmail_messages` set status=3 where deleted_flag=1 and status!=3; Query OK, 227 rows affected (1 min 14.66 sec) Datensätze gefunden: 227 Geändert: 227 Warnungen: 0
[17 Jun 2010 11:38]
Valeriy Kravchuk
Please, check if the same problems happen with a newer version, 5.1.48.
[12 Jul 2010 15:13]
Harald Reindl
As far i try to reprocduce it seems to be solved in 5.1.48 or earlier
[12 Jul 2010 15:29]
Valeriy Kravchuk
Not repeatable with current versions.