Skip to content

Commit

Permalink
Create index in vulnerability_record table (#18949)
Browse files Browse the repository at this point in the history
add index for better query performance

Signed-off-by: stonezdj <daojunz@vmware.com>
  • Loading branch information
stonezdj committed Jul 20, 2023
1 parent 73533d8 commit 5e4163b
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions make/migrations/postgresql/0120_2.9.0_schema.up.sql
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,10 @@ SET cvss_score_v3 = (vendor_attributes->'CVSS'->'nvd'->>'V3Score')::double preci
WHERE jsonb_path_exists(vendor_attributes::jsonb, '$.CVSS.nvd.V3Score');

CREATE INDEX IF NOT EXISTS idx_vulnerability_record_cvss_score_v3 ON vulnerability_record (cvss_score_v3);
CREATE INDEX IF NOT EXISTS idx_vulnerability_registration_uuid ON vulnerability_record (registration_uuid);
CREATE INDEX IF NOT EXISTS idx_vulnerability_record_cve_id ON vulnerability_record (cve_id);
CREATE INDEX IF NOT EXISTS idx_vulnerability_record_severity ON vulnerability_record (severity);
CREATE INDEX IF NOT EXISTS idx_vulnerability_record_package ON vulnerability_record (package);

/* add summary information in scan_report */
ALTER TABLE scan_report ADD COLUMN IF NOT EXISTS critical_cnt BIGINT;
Expand Down

0 comments on commit 5e4163b

Please sign in to comment.