Replace auction_orders table with index on order_uids column#4568
Draft
MartinquaXD wants to merge 2 commits into
Draft
Replace auction_orders table with index on order_uids column#4568MartinquaXD wants to merge 2 commits into
auction_orders table with index on order_uids column#4568MartinquaXD wants to merge 2 commits into
Conversation
|
Reminder: Please update the DB Readme and comment whether migrations are reversible (include rollback scripts if applicable).
Caused by: |
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 join this conversation on GitHub.
Already have an account?
Sign in to comment
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
When I investigated some of the fallout of the recent DNS issues I noticed that the post-processing that happens in the autopilot run loop (storing important bookkeeping information in the DB before telling the winner to

/settle) can be very slow. The biggest offender was thesave_auctioncall that first writes intocompetition_auctionsand then into theauction_orderstable. This currently routinely takes 250-500ms according to our metrics.However, it seems like the write into the
auction_orderstable is completely redundant as it duplicates the information we already have incompetition_auctions::order_uids. The new redundant table was introduced in #4233 to quickly find all auctions that contained a given order uid. However, this can also be achieved using a GIN index on the existingorder_uidstable.Changes
Create GIN index on
competition_auctions::order_uidsand dropsauction_ordersand updates the remaining references accordingly (db readme, debug skill).How to test
TODO: take a mainnet snapshot, apply the change there, and verify the GIN index gives reasonable performance