-
Notifications
You must be signed in to change notification settings - Fork 180
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
Move Regional Records computation to Auxiliary table #10122
Merged
gregorbg
merged 13 commits into
thewca:main
from
gregorbg:feature/regional-records-aux-table
Oct 29, 2024
Merged
Move Regional Records computation to Auxiliary table #10122
gregorbg
merged 13 commits into
thewca:main
from
gregorbg:feature/regional-records-aux-table
Oct 29, 2024
Conversation
This file contains 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
danieljames-dj
approved these changes
Oct 23, 2024
@@ -29,6 +29,11 @@ | |||
huge). | |||
</p> | |||
|
|||
<%= alert :warning do %> | |||
This script relies on auxiliary tables which are computed as part of <%= link_to "running CAD", admin_compute_auxiliary_data_path, target: :_blank %>. | |||
<b>It will not deliver accurate results for specific competitions if CAD hasn't been run after the results posting.</b> |
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.
Maybe replace "after the results posting" with "after the 'import results' step", so that it won't get confused with last step?
gregorbg
force-pushed
the
feature/regional-records-aux-table
branch
from
October 29, 2024 03:15
e8de5c1
to
fe25062
Compare
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.
Supersedes #10089, although I'm very grateful for the initial inspiration 😄
Supersedes #10120
The basic problem is that the query to pre-load existing records was breaking our necks. The simple solution of this PR is to combine
Results
data andCompetitions
data into one common,JOIN
ed table which can be indexed.That way, we can essentially reuse the same queries as before (with minor modifications to the table name etc.) but the indexes will make them reasonably fast.
Before
Benchmark on my local machine: 11390.9ms
After
Results
. This is a necessary hack because otherwise the Rails model engine gets confused! It is only an alias that is freely choosable, and in terms of understanding the contents of this query, you can mentally replaceResults
withpancake
.The relevant index is on
(eventId, countryId, competitionEndDate, best)
(as well as(eventId, countryId, competitionEndDate, average)
respectively for averages)Benchmark on my local machine: 1804.1ms