Merge lp:~wgrant/launchpad/dspc-trgm-indices into lp:launchpad

Proposed by William Grant
Status: Merged
Approved by: Stuart Bishop
Approved revision: no longer in the source branch.
Merged at revision: 15584
Proposed branch: lp:~wgrant/launchpad/dspc-trgm-indices
Merge into: lp:launchpad
Diff against target: 18 lines (+14/-0)
1 file modified
database/schema/patch-2209-23-0.sql (+14/-0)
To merge this branch: bzr merge lp:~wgrant/launchpad/dspc-trgm-indices
Reviewer Review Type Date Requested Status
Stuart Bishop (community) db Approve
Review via email: mp+109995@code.launchpad.net

Commit message

Add indices to optimise the new version of Distribution.searchSourcePackageCaches.

Description of the change

This branch adds three indices to SourcePackagePublishingHistory and DistributionSourcePackageCache. They're all to make the new Distribution.searchSourcePackageCaches query in lp:~wgrant/launchpad/package-search-timeouts nice and fast.

The existing GiST FTI index is being replaced with a faster GIN one. name gets a trigram index so LIKE '%foo%' is fast. SPPH gets a new compound index.

To post a comment you must log in.
Revision history for this message
Stuart Bishop (stub) :
review: Approve (db)
Revision history for this message
Stuart Bishop (stub) wrote :

Applied to production

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== added file 'database/schema/patch-2209-23-0.sql'
2--- database/schema/patch-2209-23-0.sql 1970-01-01 00:00:00 +0000
3+++ database/schema/patch-2209-23-0.sql 2012-06-13 11:05:31 +0000
4@@ -0,0 +1,14 @@
5+-- Copyright 2012 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 SCHEMA trgm;
11+CREATE EXTENSION pg_trgm WITH SCHEMA trgm;
12+
13+CREATE INDEX distributionsourcepackagecache__name__idx
14+ ON distributionsourcepackagecache USING gin (name trgm.gin_trgm_ops);
15+CREATE INDEX sourcepackagepublishinghistory__archive__distroseries__spn__status__idx
16+ ON sourcepackagepublishinghistory (archive, distroseries, sourcepackagename, status);
17+
18+INSERT INTO LaunchpadDatabaseRevision VALUES (2209, 23, 0);