Skip to content
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 result counting iterator #1358

Merged
merged 4 commits into from
Nov 20, 2020

Conversation

mattmundell
Copy link
Contributor

@mattmundell mattmundell commented Nov 18, 2020

What:

Speed up iterator created by init_result_get_iterator_severity.

Tests indicate about a 4x increase in result counting speed (for report counts cache).

Why:

Faster.

How did you test it:

On master:

  1. time gvmd --optimize rebuild-report-cache => 280m
  2. alter table report_counts rename to report_counts_master;
  3. drop index report_counts_by_report_and_override;
  4. CREATE TABLE IF NOT EXISTS report_counts (id SERIAL PRIMARY KEY, report integer REFERENCES reports (id) ON DELETE RESTRICT, "user" integer REFERENCES users (id) ON DELETE RESTRICT, severity decimal, count integer, override integer, end_time integer, min_qod integer);
  5. Switch to patch.
  6. time gvmd --optimize rebuild-report-cache => 77m
  7. select count(*) from report_counts; => 21280
  8. select count(*) from report_counts_master; => 21280
  9. select report, user, severity, count, override, end_time, min_qod from report_counts_master EXCEPT select report, user, severity, count, override, end_time, min_qod from report_counts; => 0 rows

Checklist:

@mattmundell mattmundell marked this pull request as ready for review November 19, 2020 07:47
@timopollmeier timopollmeier merged commit f36f1e0 into greenbone:master Nov 20, 2020
@mattmundell mattmundell deleted the report-count-speed branch December 2, 2020 10:57
@mattmundell mattmundell mentioned this pull request Dec 2, 2020
2 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants