Skip to content

Commit a3a39dd

Browse files
committed
migrations: drop imports table
The imports table is no longer used and is dropped. This frees up 136 GB of table space and 478 GB of indexes. For golang/go#39629 Change-Id: I5a381832d9d4d69408fb62052782097436c40371 Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/265242 Trust: Julie Qiu <[email protected]> Run-TryBot: Julie Qiu <[email protected]> TryBot-Result: kokoro <[email protected]> Reviewed-by: Jamal Carvalho <[email protected]>
1 parent 08196e5 commit a3a39dd

File tree

2 files changed

+32
-0
lines changed

2 files changed

+32
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
-- Copyright 2020 The Go Authors. All rights reserved.
2+
-- Use of this source code is governed by a BSD-style
3+
-- license that can be found in the LICENSE file.
4+
5+
BEGIN;
6+
7+
CREATE TABLE imports (
8+
from_path text NOT NULL,
9+
from_module_path text NOT NULL,
10+
from_version text NOT NULL,
11+
to_path text NOT NULL,
12+
PRIMARY KEY (to_path, from_path, from_version, from_module_path),
13+
FOREIGN KEY (from_path, from_module_path, from_version)
14+
REFERENCES packages(path, module_path, version) ON DELETE CASCADE
15+
);
16+
COMMENT ON TABLE imports IS
17+
'TABLE imports contains the imports for a package in the packages table. Package (from_path), in module (from_module_path) at version (from_version), imports package (to_path). We do not store the version and module at which to_path is imported because it is hard to compute.';
18+
19+
CREATE INDEX idx_imports_from_path_from_version ON imports (from_path, from_version);
20+
COMMENT ON INDEX idx_imports_from_path_from_version IS
21+
'INDEX idx_imports_from_path_from_version is used to improve performance of the imports tab.';
22+
23+
END;
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
-- Copyright 2020 The Go Authors. All rights reserved.
2+
-- Use of this source code is governed by a BSD-style
3+
-- license that can be found in the LICENSE file.
4+
5+
BEGIN;
6+
7+
DROP TABLE imports;
8+
9+
END;

0 commit comments

Comments
 (0)