-
Notifications
You must be signed in to change notification settings - Fork 93
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
Improve last token native price sql query #3269
Conversation
Reminder: Please update the DB Readme and comment whether migrations are reversible (include rollback scripts if applicable). Caused by: |
@@ -0,0 +1,2 @@ | |||
-- Create index to improve `fetch_latest_token_price` query performance. | |||
CREATE INDEX auction_prices_token_auction_id_idx ON auction_prices (token, auction_id DESC); |
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.
Leaving a reminder to myself that here is another performance reason why we will probably have to keep auction_prices
table, and erase auction prices from competition_auctions
. (there are a few more places in the code)
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.
Really nice!!
Currently, the query performs awfully for unpopular tokens. Also, the metrics were not updated properly. This PR fixes both issues. I was unable to reproduce it on staging, so another hotfix is required here to improve the tenderly alert execution time.
Execution plan before(auction_id is used first, which causes the performance issue):
And after: