-
Notifications
You must be signed in to change notification settings - Fork 121
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
tapdb: fix performance of aggregate stats #1310
base: main
Are you sure you want to change the base?
Conversation
This commit cleans up and fixes a couple of things in the universe index performance test: 1. More compact formatting for some of the queries. 2. Update index name, was incorrect before. 3. Add context to where the individual queries come from. 4. Allow specific sub tests to be run.
eac021b
to
fa0d45b
Compare
Pull Request Test Coverage Report for Build 12871932746Details
💛 - Coveralls |
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.
Nice!! Huge optimization 👏 just added a few comments/questions
@@ -0,0 +1,2 @@ | |||
-- This file is empty on purpose. There is nothing to roll back for this | |||
-- migration. |
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.
Do we not want to restore the old universe_view
in this rollback?
FROM aggregated ag | ||
JOIN universe_roots roots | ||
ON ag.universe_root_id = roots.id | ||
GROUP BY roots.asset_id, roots.group_key, roots.proof_type |
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.
Should we not tweak the index here like in the test?
CREATE INDEX IF NOT EXISTS idx_universe_leaves_asset
ON universe_leaves(
asset_genesis_id, universe_root_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.
Same with idx_mssmt_nodes_composite
numQueries = 100 * longTestScale | ||
numAssets = 100 * longTestScale | ||
numLeavesPerTree = 300 * longTestScale | ||
numQueries = 100 * longTestScale |
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.
Should the test timeout be a bit longer for the _long_test.go
or do you think the 5 minute timeout is ok?
Addition to #1302.
Difference can best be seen when running
make unit-trace pkg=tapdb long-tests=1 case=TestUniverseIndexPerformance/name=query_aggregated
:I also confirmed on mainnet that the old and new query return the exact same result:
old-query.txt
new-query.txt
The speedup on mainnet is also quite significant. The old query took 2.5 minutes while the new one only took 15 seconds.
Hopefully this should make #1302 not necessary (but let's keep it anyway, since it's a good idea as well).
Shout out to @jbrill who's performance test setup allowed me to test this quite easily.