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

Improve DestroyStackJob #1379

Merged
merged 1 commit into from
Nov 14, 2024
Merged

Improve DestroyStackJob #1379

merged 1 commit into from
Nov 14, 2024

Conversation

casperisfine
Copy link
Contributor

@casperisfine casperisfine commented Nov 14, 2024

Followup: #1376, #1377

Do all the delete in batch of 1k all in the DB.

Rather than fetch a list of IDs and generate a big IN delete query, we can just do it with a sub query and a LIMIT.

On MySQL specifically directly do a DELETE ... LIMIT, but SQLite and PG don't support that syntax so we use a DELETE FROM (SELECT id .. LIMIT) instead.

Do all the delete in batch of 1k all in the DB.

Rather than fetch a list of IDs and generate a big `IN` delete
query, we can just do it with a sub query and a LIMIT.

On MySQL specifically we could directly do a `DELETE ... LIMIT`,
but SQLite and PG don't support that syntax.
@casperisfine casperisfine merged commit 50ab00a into main Nov 14, 2024
15 checks passed
@casperisfine casperisfine deleted the batch-delete-all branch November 14, 2024 10:01
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