Skip to content

Commit 878ff57

Browse files
committed
problem: GetVulnerabilities is slow
create a partial index on the host_creds table where result is not blank. This drops the query GetVulnerabilities runs from a second or two to almost zero.
1 parent 294b777 commit 878ff57

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

sshauditor/store.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@ UPDATE sqlite_master SET SQL=REPLACE(SQL, 'priority', 'scan_interval') WHERE nam
5454
PRAGMA writable_schema=0;
5555
UPDATE credentials set scan_interval=14 where scan_interval == 0;
5656
UPDATE host_creds set scan_interval=14 where scan_interval == 0;
57+
CREATE INDEX IF NOT EXISTS host_creds_vulnerable ON host_creds (result) WHERE result != '';
5758
`
5859

5960
type Host struct {

0 commit comments

Comments
 (0)