Merge lp:~stevenk/launchpad/branch-trgm-indicies into lp:launchpad

Proposed by Steve Kowalik
Status: Merged
Approved by: Steve Kowalik
Approved revision: no longer in the source branch.
Merged at revision: 16493
Proposed branch: lp:~stevenk/launchpad/branch-trgm-indicies
Merge into: lp:launchpad
Diff against target: 15 lines (+11/-0)
1 file modified
database/schema/patch-2209-43-0.sql (+11/-0)
To merge this branch: bzr merge lp:~stevenk/launchpad/branch-trgm-indicies
Reviewer Review Type Date Requested Status
Stuart Bishop (community) db Approve
Review via email: mp+148082@code.launchpad.net

Commit message

Two new GIN trigram indices on Branch.name and Branch.unique_name to help branch searching.

Description of the change

Create GIN trigram indicies on Branch.name and Branch.unique_name to help the searching queries that are behind the branch vocabs.

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

Yup.

I'm rather surprised we don't have an existing index on name to drop, but we don't. We need to keep the existing unique_name index as it is enforcing the unique constraint.

review: Approve (db)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== added file 'database/schema/patch-2209-43-0.sql'
2--- database/schema/patch-2209-43-0.sql 1970-01-01 00:00:00 +0000
3+++ database/schema/patch-2209-43-0.sql 2013-02-14 00:18:23 +0000
4@@ -0,0 +1,11 @@
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 INDEX branch__name__trgm ON branch
11+ USING gin (lower(name) trgm.gin_trgm_ops);
12+CREATE INDEX branch__unique_name__trgm ON branch
13+ USING gin (lower(unique_name) trgm.gin_trgm_ops);
14+
15+INSERT INTO LaunchpadDatabaseRevision VALUES (2209, 43, 0);