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

Fix exponential growth of garbage cleaning query run time #32

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

dr-yd
Copy link

@dr-yd dr-yd commented Nov 24, 2021

Grouping by attachment ID before joining produces the same behavior as intended and reduced the query run time from 55min at 100% CPU to 700ms for our use case with 42k attachments and 130k email_attachment entries.

Grouping by attachment ID before joining produces the same behavior as intended and reduced the query run time from 55min at 100% CPU to 700ms for our use case with 42k attachments and 130k email_attachment entries.
@mattgrshaw
Copy link
Member

@dr-yd Thanks for the PR! We'll take a look at this for our next release.

@mark-barnes-sp
Copy link

Our server hasn't been brought down, but we're experiencing lots of database errors with SQL statements like this one:
INSERT INTO wp_oses_email_attachments (email_id, attachment_id, filename) VALUES (311693, 31692, '')
Lock wait timeout exceeded; try restarting transaction

A slow update statement on the wp_oses_email_attachments would explain that error. We have ~32k records in wp_oses_attachments and wp_oses_email_attachments. I haven't tested the PR, but I'd be very glad to see improvement in this query.

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

Successfully merging this pull request may close these issues.

3 participants