migrations: add search_documents.module_path index

An index is added to search_documents.module_path to reduce CPU load on
the following query:

SELECT package_path, version
FROM search_documents
WHERE module_path = $1

Adding this index significantly reduce database CPU usage when
reprocessing a lot of alternative modules.

Change-Id: Ic278ad652df95380b570373f188a40053627cb18
Reviewed-on: https://team-review.git.corp.google.com/c/golang/discovery/+/732840
Reviewed-by: Jonathan Amsterdam <jba@google.com>
CI-Result: Cloud Build <devtools-proctor-result-processor@system.gserviceaccount.com>
This commit is contained in:
Julie Qiu 2020-04-30 10:17:41 -04:00 коммит произвёл Julie Qiu
Родитель b4026a5e44
Коммит 29aee0d0e7
2 изменённых файлов: 18 добавлений и 0 удалений

Просмотреть файл

@ -0,0 +1,9 @@
-- Copyright 2020 The Go Authors. All rights reserved.
-- Use of this source code is governed by a BSD-style
-- license that can be found in the LICENSE file.
BEGIN;
DROP INDEX idx_search_documents_module_path;
END;

Просмотреть файл

@ -0,0 +1,9 @@
-- Copyright 2020 The Go Authors. All rights reserved.
-- Use of this source code is governed by a BSD-style
-- license that can be found in the LICENSE file.
BEGIN;
CREATE INDEX idx_search_documents_module_path ON search_documents (module_path);
END;