Skip to content
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

CRM/Contribute - Add query optimization for creditnote_id #13511

Merged
merged 1 commit into from Jan 29, 2019

Conversation

pfigel
Copy link
Contributor

@pfigel pfigel commented Jan 29, 2019

Overview

When contributions are cancelled or refunded, the field creditnote_id is set to the next sequential number following the last generated creditnote_id.

Before

The query used to determine the last creditnote_id looks at all contributions in the database.

After

The query only looks at contributions with an existing creditnote_id, which is typically only a small subset of all contributions.

Comments

Query runtime went from about ~2.5 seconds to ~0.01s on a relatively beefy server with >10M contributions. Thanks to @JoeMurray for the idea!

This adds a minor query optimization to createCreditNoteId() that
should significantly improve performance when contributions are
cancelled or refunded in environments with many contributions.
@civibot
Copy link

civibot bot commented Jan 29, 2019

(Standard links)

@civibot civibot bot added the master label Jan 29, 2019
@JoeMurray
Copy link
Contributor

Merge on Pass.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
3 participants