Merge lp:~cjwatson/launchpad/package-cache-indexes into lp:launchpad

Proposed by Colin Watson on 2016-06-02
Status: Merged
Merged at revision: 18105
Proposed branch: lp:~cjwatson/launchpad/package-cache-indexes
Merge into: lp:launchpad
Diff against target: 16 lines (+12/-0)
1 file modified
database/schema/patch-2209-78-2.sql (+12/-0)
To merge this branch: bzr merge lp:~cjwatson/launchpad/package-cache-indexes
Reviewer Review Type Date Requested Status
Colin Watson Approve on 2016-06-17
Review via email: mp+296379@code.launchpad.net

Commit Message

Add DistributionSourcePackageCache(sourcepackagename, archive) and DistributionSourcePackageCache(binpkgnames) indexes.

Description of the Change

Add a DistributionSourcePackageCache(sourcepackagename, archive) index. This makes the upcoming changes to SourcePackageNameVocabulary to use the package cache perform much better - a few milliseconds vs. about a second on dogfood for reasonably typical queries.

Also add a DistributionSourcePackageCache(binpkgnames) index, which makes it feasible to implement a cache-aware equivalent of BinaryAndSourcePackageNameVocabulary using that column as well as SourcePackageName.name. This is much faster than going through DistroSeriesPackageCache in that case.

This can be applied as a hot patch.

To post a comment you must log in.
Colin Watson (cjwatson) wrote :

I accidentally landed this as part of spn-vocabulary-use-dspc, so better land the remaining piece now!

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== added file 'database/schema/patch-2209-78-2.sql'
2--- database/schema/patch-2209-78-2.sql 1970-01-01 00:00:00 +0000
3+++ database/schema/patch-2209-78-2.sql 2016-06-10 16:06:22 +0000
4@@ -0,0 +1,12 @@
5+-- Copyright 2016 Canonical Ltd. This software is licensed under the
6+-- GNU Affero General Public License version 3 (see the file LICENSE).
7+
8+SET client_min_messages=ERROR;
9+
10+CREATE INDEX distributionsourcepackagecache__sourcepackagename__archive__idx
11+ ON DistributionSourcePackageCache (sourcepackagename, archive);
12+
13+CREATE INDEX distributionsourcepackagecache__binpkgnames__idx
14+ ON DistributionSourcePackageCache USING gin (binpkgnames trgm.gin_trgm_ops);
15+
16+INSERT INTO LaunchpadDatabaseRevision VALUES (2209, 78, 2);