~launchpad-pqm/launchpad/devel

7675.395.178 by Stuart Bishop
Schema tweaks to deal with bloat
1
SET client_min_messages=ERROR;
2
3
-- This index is getting bloated, and is mostly NULL.
4
ALTER TABLE Bug DROP CONSTRAINT bug_name_key;
5
CREATE UNIQUE INDEX bug__name__key ON Bug (name) WHERE name IS NOT NULL;
6
7
-- This table is huge and append only
8
ALTER TABLE BranchRevision SET (fillfactor=100);
7675.395.180 by Stuart Bishop
More fillfactors
9
ALTER TABLE MessageChunk SET (fillfactor=100);
10
ALTER TABLE Message SET (fillfactor=100);
7675.395.181 by Stuart Bishop
Fillfactor for BugActivity table
11
ALTER TABLE BugActivity SET (fillfactor=100);
7675.395.183 by Stuart Bishop
More fillfactors
12
ALTER TABLE LibraryFileContent SET (fillfactor=100);
13
ALTER TABLE Karma SET (fillfactor=100);
14
ALTER TABLE BugWatchActivity SET (fillfactor=100);
15
ALTER TABLE Country SET (fillfactor=100);
16
ALTER TABLE Continent SET (fillfactor=100);
17
ALTER TABLE DatabaseCPUStats SET (fillfactor=100);
18
ALTER TABLE DatabaseTableStats SET (fillfactor=100);
19
ALTER TABLE POTranslation SET (fillfactor=100);
20
7675.395.178 by Stuart Bishop
Schema tweaks to deal with bloat
21
7675.395.179 by Stuart Bishop
Index cleanups
22
-- Unwanted indexes
23
DROP INDEX archive__commercial__idx;
24
DROP INDEX bugwatchactivity__date__idx;
25
DROP INDEX binarypackagerelease_version_idx; -- Duplicate
26
DROP INDEX product_bugcontact_idx; -- Duplicate
27
DROP INDEX hwvendorname__name__idx; -- Duplicate
28
29
-- Missing constraint we believe we rely on, and drop the duplicate
30
-- non-unique index.
31
ALTER TABLE Packaging ALTER COLUMN distroseries SET NOT NULL;
32
DROP INDEX packaging__distroseries__sourcepackagename__idx;
33
7675.395.185 by Stuart Bishop
FeatureFlag.value should be NOT NULL
34
-- Should be NOT NULL per Bug #726128
35
ALTER TABLE FeatureFlag ALTER COLUMN value SET NOT NULL;
36
7675.395.178 by Stuart Bishop
Schema tweaks to deal with bloat
37
INSERT INTO LaunchpadDatabaseRevision VALUES (2208, 42, 0);
38