Skip to content

Commit 8ac0e15

Browse files
committed
migrations: add paths table and units.path_id
A paths table is added, which contains the path string for every path in the units table. This table is added to replace units.path in order to reduce the index size on that column and improve performance. For golang/go#39629 Change-Id: I9d173bbb8a1680176f1807d8d3561cd6906afaf3 Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/267437 Trust: Julie Qiu <[email protected]> Reviewed-by: Jonathan Amsterdam <[email protected]>
1 parent 81780f2 commit 8ac0e15

File tree

2 files changed

+26
-0
lines changed

2 files changed

+26
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
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+
ALTER TABLE units DROP COLUMN path_id;
8+
DROP TABLE paths;
9+
10+
END;
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
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 paths (
8+
id INTEGER GENERATED ALWAYS AS IDENTITY PRIMARY KEY,
9+
path TEXT NOT NULL
10+
);
11+
COMMENT ON TABLE paths IS
12+
'TABLE paths contains the path string for every path in the units table.';
13+
14+
ALTER TABLE units ADD COLUMN path_id INTEGER;
15+
16+
END;

0 commit comments

Comments
 (0)