-
Notifications
You must be signed in to change notification settings - Fork 82
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
Adjust the sql query for total surplus #3090
Conversation
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.
Change looks alright but agree with @squadgazzz's comment.
Performance should be good since "jit_orders" table also has index on owners.
Can you please compare the performance of the surplus query for an account that has many regular orders by manually executing the old and the new query?
Would be a shame if we pessimise the performance of the common use case by adding support for jit orders.
I compared it previously with a random owner and it was comparative. But for the sake of mind, I searched for owners with most entries in "orders" table and used them to test the performance. With owners that have 10-20k entries, this version of code introduces the least performance hit, practically negligible. |
Description
Fixes #3089
Changes
Includes orders from "jit_orders" to calculate the total surplus.
How to test
Executed manually the new query against prod db. Two things are verified:
Performance should be good since "jit_orders" table also has index on owners.