-
Couldn't load subscription status.
- Fork 9
Optimise deleteByTypeAndClient method #43
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
base: master
Are you sure you want to change the base?
Conversation
| @@ -0,0 +1,2 @@ | |||
| CREATE INDEX IF NOT EXISTS IDX_IDEMPOTENT_ACTION_TYPE_CLIENT | |||
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 was just googling to see if there's a mariadb equivalent of concurrently - looks like adding ALGORITHM=INPLACE LOCK=NONE may do the trick?
| "DELETE FROM idempotent_action " + | ||
| "WHERE type = :type " + | ||
| " AND client = :client " + | ||
| "ORDER BY created_at ASC " + |
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.
This was a good spot - it's not necessary for this to be deterministic!
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.
Nice one! π
β Context
On applications with large
idempotent_actiontables,deleteByTypeAndClientcan be optimised by removing the need to sort actions before deleteπ Changes
deleteByTypeAndClientqueriesdeleteByTypeAndClientqueries to let db return/delete records in natural order without the overhead of sortingConsiderations
Actions will no longer be deleted oldest first