-
Notifications
You must be signed in to change notification settings - Fork 2
Open
Labels
Description
The following index dramatically speeds up common queries:
CREATE INDEX results_i_build_pkg ON results (build_id, pkg_id);
It increases the size of the database by about 1/3, but compare, e.g., the GetResultsInCategory query (bottleneck of https://releng.netbsd.org/bulktracker/build/645/meta-pkgs):
-
Without index:
% time sqlite3 ./BulkTracker.db.~1~ "select r.*, p.* from results r join pkgs p on (r.pkg_id == p.pkg_id) where p.category = 'meta-pkgs/' and r.build_id = 645" ... sqlite3 ./BulkTracker.db.~1~ 2.32s user 0.40s system 99% cpu 2.732 total -
With index:
% time sqlite3 ./BulkTracker.db "select r.*, p.* from results r join pkgs p on (r.pkg_id == p.pkg_id) where p.category = 'meta-pkgs/' and r.build_id = 645" ... sqlite3 ./BulkTracker.db 0.01s user 0.01s system 98% cpu 0.015 total
GetSingleResultByPkgName (bottleneck of https://releng.netbsd.org/bulktracker/pkg/17227701):
-
Without index:
% time sqlite3 ./BulkTracker.db.~1~ "select r.*, p.* from results r, pkgs p where r.build_id == 644 and r.pkg_id == p.pkg_id and r.pkg_name = 'libreoffice-24.2.1.2nb2'" 17225614|644|7533|libreoffice-24.2.1.2nb2|2||3|7533|misc/|libreoffice sqlite3 ./BulkTracker.db.~1~ 2.31s user 0.46s system 99% cpu 2.801 total -
With index:
% time sqlite3 ./BulkTracker.db "select r.*, p.* from results r, pkgs p where r.build_id == 644 and r.pkg_id == p.pkg_id and r.pkg_name = 'libreoffice-24.2.1.2nb2'" 17225614|644|7533|libreoffice-24.2.1.2nb2|2||3|7533|misc/|libreoffice sqlite3 ./BulkTracker.db 0.02s user 0.01s system 97% cpu 0.024 total
Given the amount of CPU time mollari is spending in bulktracker, I think this couple hundred megabytes of space is worth it.
Reactions are currently unavailable