-
Notifications
You must be signed in to change notification settings - Fork 40
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
More performance enhancements #1850
Conversation
…ment account id, optimizer doesn't seem to be working right
…we have, add some extras the database was having to grab.
@Jxio Looks like you're right about the counts (this is executed on production in OCP): Probably need to talk to Ethan and John about removing them if they want some serious performance. |
@@ -320,7 +331,7 @@ def search_purchase_history( # noqa:E501; pylint:disable=too-many-arguments, to | |||
count_future = executor.submit(cls.get_count, auth_account_id, search_filter) | |||
sub_query = cls.generate_subquery(auth_account_id, search_filter, limit, page) | |||
query = query.filter(Invoice.id.in_(sub_query.subquery().select())).order_by(Invoice.id.desc()) | |||
result_future = executor.submit(db.session.query(Invoice).from_statement(query).all) |
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 no good, would get rid of all of nice load_only
all the rows would have to be reloaded at serialization
.outerjoin(PaymentLineItem, PaymentLineItem.invoice_id == Invoice.id) | ||
.outerjoin( | ||
db.session.query(Invoice) | ||
.join(PaymentAccount, Invoice.payment_account_id == PaymentAccount.id) |
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.
Joins make sense for these, they will always occur
For Monday: Needs quick side by side comparison |
By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of the sbc-pay license (Apache 2.0).