-
Notifications
You must be signed in to change notification settings - Fork 28
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
rsc: Optimize blob eviction deletion #1615
Conversation
V-FEXrt
commented
Jul 31, 2024
- Adds index to blob(updated_at) which speeds up the TTL check for old blobs
- Completes the blob eviction lookup and delete in one query to not waste time repeating work.
- Makes delete query much more static instead of passing in 16k variables
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Definitely seems like a reasonable optimization. I imagine we used to do something else with the blobs between the fetch and the deletion?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
|
||
Ok(affected) | ||
DELETE from blob b | ||
WHERE b.id IN (SELECT id FROM eligible_blob_ids) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is it not possible to just do IN (eligible_blob_ids.id)
or something like that? I'm surprised to see a select is needed again.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nope :( I tried that. As fair as I could tell this didn't actually effect the query plan since WITH
is kind of just writing an alias for a subquery
Not really. It was previously just split into two queries for simplicity reasons |