Skip to content

Conversation

@daveking-tw
Copy link
Contributor

@daveking-tw daveking-tw commented Apr 29, 2022

❓ Context

On applications with large idempotent_action tables, deleteByTypeAndClient can be optimised by removing the need to sort actions before delete

πŸš€ Changes

  • add index definition for deleteByTypeAndClient queries
  • removed sort in deleteByTypeAndClient queries to let db return/delete records in natural order without the overhead of sorting

Considerations

Actions will no longer be deleted oldest first

@daveking-tw daveking-tw changed the title Tune deleteByTypeAndClient Tune deleteByTypeAndClient method Apr 29, 2022
@daveking-tw daveking-tw changed the title Tune deleteByTypeAndClient method Optimise deleteByTypeAndClient method Apr 29, 2022
@@ -0,0 +1,2 @@
CREATE INDEX IF NOT EXISTS IDX_IDEMPOTENT_ACTION_TYPE_CLIENT
Copy link
Contributor

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 " +
Copy link
Contributor

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!

Copy link
Contributor

@phildobsontw phildobsontw left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice one! πŸš€

@MatthewStocks
Copy link

/wise-bot sync-codeowners

@wise-github-bot-app
Copy link

These are all the things I can do:

approve: Creates synthetic approvals for retrospective reviews.
emergency-merge: This command no longer exists. Please use a different emergency merge command.
incident-merge: Merges the PR even with failed checks. Use only under during live Incidents.
misc-emergency-merge: Merges the PR even with failed checks. Use only when other emergency merge options do not satifsy the use case.
broken-config-merge: Merges the PR even with failed checks. Use only when CODEOWNERS or tw-rules are broken.
multi-codeowners-merge: Emergency merges a PR in a repository with multiple CODEOWNERS when getting all reviews takes too long. Requires approval from a default repository owner and at least 3 other approvals from teams in CODEOWNERS.
ping: Check if the bot is properly listening
run-checks: Runs all checks in the PR. Use it if the automatic run was buggy
run-action: Forces a specific action to run
org-oidc: Opt in or out of Wise OIDC schema

@MatthewStocks
Copy link

/wise-bot run-action sync-codeowners

@wise-github-bot-app
Copy link

πŸ”΄

No CODEOWNERS file was found in your repository.

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.

4 participants