Bug #8565 | ALTER TABLE MODIFY adds duplicate keys which slow down SELECTs | ||
---|---|---|---|
Submitted: | 17 Feb 2005 11:50 | Modified: | 13 Jul 2012 6:58 |
Reporter: | anzenews asdf | Email Updates: | |
Status: | Duplicate | Impact on me: | |
Category: | MySQL Server: DDL | Severity: | S2 (Serious) |
Version: | 5.0.30 | OS: | Any (*) |
Assigned to: | Assigned Account | CPU Architecture: | Any |
[17 Feb 2005 11:50]
anzenews asdf
[11 Aug 2006 13:58]
Bernhard Doebler
Hi, is this bug still existing? I'm doing some mass INSERTs (CSV-Files) INTO MySQL 5.0.22 using prepared statements. Before inserting I ALTER TABLE DISABLE KEYS and afterward ENABLE KEYS. My INDEXES file grows huge. When I drop an the index over a DATETIME field and then add the very same index the MYI files grows to an absolutely acceptable size. Best, Bernhard
[11 Aug 2006 14:40]
Bernhard Doebler
I just see my problem more refers to: http://bugs.mysql.com/bug.php?id=4692
[18 Dec 2006 10:55]
anzenews asdf
Is anyone working on this? The bug is still there in 5.0.30... The fix shouldn't be too hard to do and I guess there are many people who don't even realize their queries are slower than they ought to be - because of this flaw. Someone? Please? Best, Anze
[18 Dec 2006 11:20]
Ingo Strüwing
Hi. This is still on the todo list. Unfortunately there are still bugs with higher priority. I am sorry. Regards Ingo
[23 Oct 2007 1:09]
anzenews asdf
Does that mean that it won't be solved? It's been almost two years since the initial bug report...
[23 Oct 2007 9:14]
Ingo Strüwing
Possible, but I can't promise it. ;-( I have seen a couple of problems that hung around for a long time, and suddenly were raised in priority...
[2 Sep 2008 16:59]
Ingo Strüwing
The statement ALTER TABLE MODIFY still adds an index. Even in 6.0.7. However the select performance doesn't change with one row in the table. How many rows do I need to get a measurable difference?
[2 Sep 2008 17:59]
anzenews asdf
I have noticed the difference (couldn't miss it actually :) on a table with ~ 5000 rows and 30 indexes on the same column. I know the selects took seconds to complete. Since then I have used a workaround in my CMS that automatically keeps track of the indexes and removes the unneeded ones, so I can't help you with a more elaborate speed comparison. However, duplicate indexes are always bad news - they use up space and they slow down queries (at least updates if not also selects). Hope it helps.
[3 Sep 2008 10:07]
Ingo Strüwing
Sure, duplicate indexes are bad. This is accepted as being a bug, which has to be fixed eventually. However it seems that the mere existence of duplicate indexes isn't seen as a big problem. My guess is that this opinion might change, if we can prove that it has an impact on select performance. I created the table, inserted 5000 rows, measured SELECT COUNT(*) plus SELECT * ORDER BY id as less than a second, did 29 ALTER TABLE MODIFY, verified that I have 30 indexes, and measured SELECT COUNT(*) plus SELECT * ORDER BY id again as less than a second. So it doesn't seem to be a problem in 6.0.7 any more. Or do you think, a more complex select is required to show the effect? If so, can you please give an example?
[3 Sep 2008 10:17]
anzenews asdf
I guess the query should use the index(es), but apart from that I can't really say. The queries I was using were quite simple. It is possible that the development of query optimizer minimized the impact of this bug in current MySQL version (the query only uses one index instead of all of them), but it is only a question of time before some changes re-surface this problem. You could try doing INSERTs and UPDATEs on a higher number of rows (50000) - updating multiple indexes will take more time, no matter what optimizer does.
[7 Oct 2008 21:10]
Konstantin Osipov
Bug#37520 was marked a duplicate of this bug
[13 Jul 2012 6:58]
Jon Olav Hauglid
Closing as a duplicate of Bug#37520