Create index on task with job_id

Missing index with job_id, when query task with job_id, it cause a full table scan, caused performance issue
  Fixes #15271

Signed-off-by: stonezdj <stonezdj@gmail.com>
This commit is contained in:
stonezdj 2022-03-02 20:51:36 +08:00
parent 74d2670616
commit 9d480a84d2

View File

@ -30,3 +30,5 @@ ALTER TABLE vulnerability_record ALTER COLUMN id TYPE BIGINT;
ALTER SEQUENCE vulnerability_record_id_seq AS BIGINT; ALTER SEQUENCE vulnerability_record_id_seq AS BIGINT;
ALTER TABLE report_vulnerability_record ALTER COLUMN id TYPE BIGINT; ALTER TABLE report_vulnerability_record ALTER COLUMN id TYPE BIGINT;
ALTER SEQUENCE report_vulnerability_record_id_seq AS BIGINT; ALTER SEQUENCE report_vulnerability_record_id_seq AS BIGINT;
CREATE INDEX IF NOT EXISTS idx_task_job_id ON task (job_id);