зеркало из https://github.com/golang/pkgsite.git
migrations: add indexes to paths table
A UNIQUE index is add to paths.path, since values in that column are unique. An index is added to paths(path, id), which should improve performance for reverse lookups from path to id, since the index will be sorted by path not id. Change-Id: I51df32ce2e85835f89defc6b9e7eeee97112a7be Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/267457 Reviewed-by: Jonathan Amsterdam <jba@google.com> Trust: Julie Qiu <julie@golang.org>
This commit is contained in:
Родитель
7fac08fa84
Коммит
ea7cf0991c
|
@ -0,0 +1,10 @@
|
|||
-- 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;
|
||||
|
||||
ALTER TABLE paths DROP CONSTRAINT paths_path_key;
|
||||
DROP INDEX idx_paths_path_id;
|
||||
|
||||
END;
|
|
@ -0,0 +1,10 @@
|
|||
-- 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;
|
||||
|
||||
ALTER TABLE paths ADD CONSTRAINT paths_path_key UNIQUE (path);
|
||||
CREATE INDEX idx_paths_path_id ON paths(path, id);
|
||||
|
||||
END;
|
Загрузка…
Ссылка в новой задаче