Optimize removeTrigger method - #1436
Open
kkalin68 wants to merge 1 commit into
Open
Conversation
Signed-off-by: Konstantin Kalin <konstantin.kalin@socotra.com>
Contributor
|
@kkalin68 i have never heard select count() was slower as most DB's like RDS are super optimized for this especially if selecting by an indexed field? I see you are basically doing a "select TOP 1" query so it finds something immediately and exits. |
melloware
approved these changes
Dec 10, 2025
Author
It is not slower if you need to know the count. Here the count was used to see if any records exist and |
Contributor
|
absolutely i like it. |
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
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.
This PR optimizes
removeTriggermethod.Fixes issue # NA
Changes
removeTriggermethod checks if there are more tiggers associated with a job every time when a trigger is being removed. AlthoughSELECT COUNTis technically correct it will be always slower and need more IO versus the proposed change. The change reduces amount of IO which is important on Cloud based DB (aka RDS) as well as improve the performance if a job has a few thousands of triggersChecklist
git commit -son my commits, and submit this code under terms of the Apache 2.0 license and assign copyright to the Quartz project owners(If you're not using command-line, you can use a browser extension )
In submitting this contribution, I agree to the terms of contributing as referred to here:
https://github.com/quartz-scheduler/contributing/blob/main/CONTRIBUTING.md