-
Notifications
You must be signed in to change notification settings - Fork 158
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
Speed up regular result iterator #1370
Merged
Merged
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
This almost doubles the speed of the default results case with my 800k result db.
This puts the new severity calculation in a single place in the SQL: in the FROM clause. This speeds up my results page with a 800k result db and overrides enabled from 110s to 40s.
This halves the time of the results query: called current severity 59s inlined current severity 74s WITH and called current severity 39s WITH and inlined current severity 29s
mattmundell
requested review from
timopollmeier
and removed request for
timopollmeier
December 7, 2020 19:19
timopollmeier
approved these changes
Dec 8, 2020
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.
What:
Speed up iterator created by init_result_get_iterator:
Improvements to my GET_RESULTS times:
This translates to similar jumps in the GSA Results page.
This PR is similar to the changes to the result counting iterator in #1358.
Why:
Improves the speed of the GSA result pages when using bigger dbs, especially the Results page.
Making the dynamic cases fast may enable us to switch to "query-time" dynamic-only severity (#1337).
How did you test it:
With an 800k result db, having 3 overrides.
git checkout master
make install
gvmd
update settings set value = 0 where owner = (select id from users where name = 'm') and uuid = '77ec2444-e7f2-4a80-a59b-f4237782d93f';
time o m m '<get_results details="1" filter="apply_overrides=0 min_qod=70 sort-reverse=severity rows=10 first=1"/>' > /tmp/master-st
=> 17stime o m m '<get_results details="1" filter="apply_overrides=1 min_qod=70 sort-reverse=severity rows=10 first=1"/>' > /tmp/master-st-ov
=> 248supdate settings set value = 1 where owner = (select id from users where name = 'm') and uuid = '77ec2444-e7f2-4a80-a59b-f4237782d93f';
time o m m '<get_results details="1" filter="apply_overrides=0 min_qod=70 sort-reverse=severity rows=10 first=1"/>' > /tmp/master-dy
=> 45stime o m m '<get_results details="1" filter="apply_overrides=1 min_qod=70 sort-reverse=severity rows=10 first=1"/>' > /tmp/master-dy-ov
=> 415stime o m m '<get_results details="1" filter="rexec apply_overrides=1 min_qod=70 sort-reverse=severity rows=10 first=1"/>' > /tmp/master-dy-ov-filter
=> 209s (with pg jit off)git checkout lateral-results
make install
gvmd
update settings set value = 1 where owner = (select id from users where name = 'm') and uuid = '77ec2444-e7f2-4a80-a59b-f4237782d93f';
time o m m '<get_results details="1" filter="apply_overrides=0 min_qod=70 sort-reverse=severity rows=10 first=1"/>' > /tmp/lateral-st
=> 6stime o m m '<get_results details="1" filter="apply_overrides=1 min_qod=70 sort-reverse=severity rows=10 first=1"/>' > /tmp/lateral-st-ov
=> 34supdate settings set value = 1 where owner = (select id from users where name = 'm') and uuid = '77ec2444-e7f2-4a80-a59b-f4237782d93f';
time o m m '<get_results details="1" filter="apply_overrides=0 min_qod=70 sort-reverse=severity rows=10 first=1"/>' > /tmp/lateral-dy
=> 5stime o m m '<get_results details="1" filter="apply_overrides=1 min_qod=70 sort-reverse=severity rows=10 first=1"/>' > /tmp/lateral-dy-ov
=> 33stime o m m '<get_results details="1" filter="rexec apply_overrides=1 min_qod=70 sort-reverse=severity rows=10 first=1"/>' > /tmp/lateral-dy-ov-filter
=> 73s (with pg jit off)cd /tmp
diff master-st lateral-st
=> emptydiff master-st-ov lateral-st-ov
=> emptydiff master-dy lateral-dy
=> emptydiff master-dy-ov lateral-dy-ov
=> emptydiff master-dy-ov-filter lateral-dy-ov-filter
=> emptyChecklist: