Tighter filter on all solvable orders query#4131
Merged
MartinquaXD merged 4 commits intomainfrom Feb 6, 2026
Merged
Conversation
m-sz
approved these changes
Feb 6, 2026
squadgazzz
approved these changes
Feb 6, 2026
Contributor
There was a problem hiding this comment.
Code Review
The added filter for ethflow_refunds is correct. However, it creates a redundant join in the solvable_orders query, impacting performance. A fix is suggested in the review comment.
I am having trouble creating individual review comments. Click here to see my feedback.
crates/database/src/orders.rs (732)
This filter makes the LEFT JOIN on ethflow_refunds at line 806 redundant. Since live_orders no longer contains refunded orders, tx_hash from ethflow_refunds will always be NULL.
To improve clarity and performance, remove the unnecessary join by changing lines 803-808.
- LEFT JOIN LATERAL (
- SELECT ROW(tx_hash, eo.valid_to) AS ethflow_data
- FROM ethflow_orders eo
- LEFT JOIN ethflow_refunds r ON r.order_uid = eo.uid
- WHERE eo.uid = lo.uid
- ) ed ON TRUE
+ LEFT JOIN LATERAL (
+ SELECT ROW(NULL::bytea, eo.valid_to) AS ethflow_data
+ FROM ethflow_orders eo
+ WHERE eo.uid = lo.uid
+ ) ed ON TRUE
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 subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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.
Description
Forgot that I already hit
merge when readyon #4129 so I was to slow to merge the same optimization for the open orders query.