-
Notifications
You must be signed in to change notification settings - Fork 51
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Slow queries when finding the revisions of a single entity. #45
Comments
@SanderVerkuil #44 is fixed on Nevertheless, it's quite hard to give hints on how to increase performance regarding queries without a better understanding of what queries you'd like to run and more precisely what |
Ah allright, prior to that I might have to either truncate all the current tables that exist, or at the very least remove all the duplicated ID's, which might take a while. But it might very well be the case that MySQL didn't like the fact that there were quite some duplicate ID's present, and that it would just perform a full table scan then. And indeed, when I'm running the query as called in the bundle itself: SELECT *
FROM audit_Entity
WHERE object_id = 865581
ORDER BY created_at DESC, id DESC
LIMIT 50 It isn't really fast, but it isn't slow either (not waiting 5 minutes for the results, but rather 45 seconds to fetch 8 results). I'll get back to you at a later time. |
@SanderVerkuil Ok, keep me updated of your findings once the tables are cleaned or truncated. |
@SanderVerkuil Any news on this? |
@SanderVerkuil I close this issue for now, feel free to reopen if needed. |
auditor
versionSummary
When running queries like:
Explained:
<null>
<null>
<null>
<null>
the queries take quite some time to run when a lot of data is present.
Current behavior
The queries are slow.
How to reproduce
SELECT * FROM audit_Entity WHERE object_id = 1
Expected behavior
I expected that the Database would be smart and use the index to speed up this query.
For some reason though, the database thinks that the cardinality of the index is too high and a full index scan is actually faster.
Possible solution
The SimpleThings EntityAudit uses basically the same structure but has a different index setup.
Instead of creating just a UNIQUE index on the
object_id
it added a joined index on both theobject_id
and theid
.I tried to create a UNIQUE index on the
id
and theobject_id
as theid
is a primary key I expected theid
to be auto-incremented and unique, but I got an error that a duplicated key existed.Perhaps this has something to do with #44?
Creating a non-unique index doesn't solve this issue, unfortunately.
The UI itself is fast because it limits the results to the 50 latest results. In the database, I'd like to see a complete overview of all the records (DataGrip limits the results to 1,500 by default) but that is quite slow.
What can be done to increase the database performance of the queries, as we really like this bundle but would also like to use this for investigative purposes.
The text was updated successfully, but these errors were encountered: