-
Notifications
You must be signed in to change notification settings - Fork 4
[_]: fix/optimise-background-removal-index #857
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
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
…ious last migration
… range fast and efficiently
Member
Author
|
Migration run @jzunigax2 |
jzunigax2
approved these changes
Jan 8, 2026
jzunigax2
requested changes
Jan 8, 2026
Contributor
jzunigax2
left a comment
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.
I guess these changes must be necessary to fix the e2e failling test
migrations/20260108150853-create-optimum-index-files-updatedat-status.js
Outdated
Show resolved
Hide resolved
migrations/20260108150853-create-optimum-index-files-updatedat-status.js
Show resolved
Hide resolved
…-status.js Co-authored-by: José Zúniga <[email protected]>
…-status.js Co-authored-by: José Zúniga <[email protected]>
|
Member
Author
|
Great, thanks! @jzunigax2 |
jzunigax2
approved these changes
Jan 9, 2026
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.



What
Another step to speedup the Drive's database. We need an index to remove files metadata records of still existing users that are stored for >1 year (or any other given period) and these changes aim to offer an efficient solution to that.
Why
Because the current index is not efficient and it is also another thing to maintain and another expense to count on INSERT time. Check this, just to get 200 records:
We aim to make this table as efficient and light as possible. The current execution time is just not acceptable and the index is also weights 3.5GB.
How
Leveraging BRIN indexes to do that on an efficient manner, as the records removed one year ago are highly correlated with their physical location on the disk due to the fact that the
updated_atis no longer updated after the files' statuses are set as DELETED.Results
After adding this index, things change quite a lot (I have not added any EXPLAIN ANALYZE as they do not seem to work good with BRIN indexes):