Skip to content
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

.cleanup_read_marks! performance? #64

Closed
pyro2927 opened this issue Oct 29, 2015 · 3 comments
Closed

.cleanup_read_marks! performance? #64

pyro2927 opened this issue Oct 29, 2015 · 3 comments

Comments

@pyro2927
Copy link
Contributor

The current .cleanup_read_marks! appears to iterate over every entry in the table, checking for older entries, and then deleting all but the newest. This could result in a lot of un-used find queries where there are no read marks that need to be cleaned for a certain readable. It seems like it could be optimized by having a query with some sort of WHERE COUNT(read_marks.id) > 1 GROUP BY readable_id, readable_type, which would only then iterate over things that actually needed cleaning.

ledermann added a commit that referenced this issue Oct 31, 2015
Run the cleanup for those readers only, who have at least one single
read_marks. Belongs to #64
@ledermann
Copy link
Owner

Great hint - thank you, @pyro2927. I have made some changes, what do you think about 7d26c80?

(For better readability, the cleanup code was moved to a separate class named GarbageCollector before)

@pyro2927
Copy link
Contributor Author

Looks awesome!

@ledermann
Copy link
Owner

Fine, I will publish the next release soon.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants