Skip to content

when deleting by IDs, split the deletion to 1000 per batch #17200

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

Merged
merged 5 commits into from
May 1, 2025

Conversation

i-just
Copy link
Contributor

@i-just i-just commented Apr 30, 2025

Description

When running a garbage collection and deleting by multiple IDs, the query that gets executed is DELETE FROM <table> WHERE id IN (<list of IDs>). If there’s a lot of data to process, this can lead to “SQLSTATE[HY000]: General error: 7 number of parameters must be between 0 and 65535” kind of error.

To prevent this, the deletion should be run in batches. I opted for a limit of 10,000 per batch.

Note: similar issue was previously reported and fixed in the Neo plugin.

Related issues

#17197

@i-just i-just requested a review from brandonkelly April 30, 2025 12:04
@brandonkelly brandonkelly changed the base branch from 5.x to 4.x May 1, 2025 22:41
@brandonkelly brandonkelly merged commit e9ecb76 into 4.x May 1, 2025
@brandonkelly brandonkelly deleted the bugfix/17197-gc-batch-ids-when-deleting-by-them branch May 1, 2025 22:54
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.

2 participants