Bug #94068 | Index performance degradation, ~50 times slower after 30 hours. reproduceable | ||
---|---|---|---|
Submitted: | 25 Jan 2019 19:19 | Modified: | 6 Mar 2019 14:33 |
Reporter: | John K | Email Updates: | |
Status: | Not a Bug | Impact on me: | |
Category: | MySQL Server | Severity: | S2 (Serious) |
Version: | 8.0.13 | OS: | Linux |
Assigned to: | CPU Architecture: | Any | |
Tags: | index virtual |
[25 Jan 2019 19:19]
John K
[25 Jan 2019 20:32]
John K
I would like to add: The situation is very concurrent. The Updates come in in a highly parallel fashion, this might play a role with the bug experienced. It doesn't need to wait for hours to verify the problem, the EXPLAIN rowcount will rise with almost every insert. Only the performance degradation is not noticeable directly as the counts are all made in memory anyway.
[26 Jan 2019 0:36]
John K
I've copied the table, modified the column to be STORED instead of VIRTUAL and thought this might solve the issue. The problem persists. I'm not sure if it's a universal problem but from my point of view INDEX on GENERATED columns is bugged and should not be used on productive environments until patched. I am solving this now by creating a new index and dropping the old one every 60 minutes, this keeps the server alive.
[26 Jan 2019 4:43]
John K
Oh well, situation changed. It's a general bug/bad behaviour and has nothing to do with the virtual column. I rebuild the whole table again, this time using a trigger instead of the virtual column. The performance degradation is the same, the "query cost" increases by throughly 10000 every hour until the server stalls to a halt as it needs 5+ seconds to do a simple select on an index containing 20 matching rows. I did not have this sort of issue on 5.7 that's new and I realized that most of my tables have that problem. I currently optimize small write-heavy tables in a cronjob which solves that problem for them but the large ones are a major pain. My guess is that it's a general issue with Innodb indexes in heavy-write environments, they become clustered and performance can drop by magnitudes within days of usage. I'm changing the bug report title to match the problem.
[26 Jan 2019 17:33]
John K
30 hours have passed, performance degraded like before Original query cost was 1.1 Now it is "query_cost": "262124.07" In 5-6 hours the server would be dead from queries on the index if it's not re-created.
[5 Feb 2019 13:47]
MySQL Verification Team
Hi, Thank you for your bug report. Sorry, but I do not think that this is a bug. You have a column which can have only two values. Hence, your EXPLAIN shows the only possible way that query can be resolved. By scanning the entire index. When you add several hundred thousands of rows, of course that query will slow down. You can mitigate it , by running ANALYZE command periodically, depending on the frequency of the row changes. In short, to me this seems like the expected behaviour.
[6 Mar 2019 1: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".