← Back to team overview

launchpad-reviewers team mailing list archive

[Merge] lp:~wgrant/launchpad/gitrepository-indices into lp:launchpad/db-devel

 

William Grant has proposed merging lp:~wgrant/launchpad/gitrepository-indices into lp:launchpad/db-devel.

Commit message:
Add various GitRepository filter/sort indices.

Requested reviews:
  Launchpad code reviewers (launchpad-reviewers)

For more details, see:
https://code.launchpad.net/~wgrant/launchpad/gitrepository-indices/+merge/261172

Add various GitRepository filter/sort indices.
-- 
Your team Launchpad code reviewers is requested to review the proposed merge of lp:~wgrant/launchpad/gitrepository-indices into lp:launchpad/db-devel.
=== added file 'database/schema/patch-2209-61-8.sql'
--- database/schema/patch-2209-61-8.sql	1970-01-01 00:00:00 +0000
+++ database/schema/patch-2209-61-8.sql	2015-06-05 02:42:25 +0000
@@ -0,0 +1,52 @@
+-- Copyright 2015 Canonical Ltd.  This software is licensed under the
+-- GNU Affero General Public License version 3 (see the file LICENSE).
+
+SET client_min_messages=ERROR;
+
+-- Target and owner-target listings.
+CREATE INDEX gitrepository__project__date_last_modified__idx
+    ON gitrepository (project, date_last_modified)
+    WHERE project IS NOT NULL;
+
+CREATE INDEX gitrepository__distribution__spn__date_last_modified__idx
+    ON gitrepository (distribution, sourcepackagename, date_last_modified)
+    WHERE distribution IS NOT NULL;
+    
+CREATE INDEX gitrepository__owner__project__date_last_modified__idx
+    ON gitrepository (owner, project, date_last_modified)
+    WHERE project IS NOT NULL;
+
+CREATE INDEX gitrepository__owner__distribution__spn__date_last_modified__idx
+    ON gitrepository (
+        owner, distribution, sourcepackagename, date_last_modified)
+    WHERE distribution IS NOT NULL;
+
+
+-- Owner listings.
+CREATE INDEX gitrepository__owner__date_last_modified__idx
+    ON gitrepository (owner, date_last_modified);
+
+
+-- Target and owner-target default lookups.
+CREATE INDEX gitrepository__project__target_default__idx
+    ON gitrepository (project)
+    WHERE target_default;
+    
+CREATE INDEX gitrepository__distribution__spn__target_default__idx
+    ON gitrepository (distribution, sourcepackagename)
+    WHERE target_default;
+    
+CREATE INDEX gitrepository__owner__project__owner_default__idx
+    ON gitrepository (owner, project)
+    WHERE owner_default;
+    
+CREATE INDEX gitrepository__owner__distribution__spn__owner_default__idx
+    ON gitrepository (owner, distribution, sourcepackagename)
+    WHERE owner_default;
+    
+
+-- FKs.
+CREATE INDEX gitrepository__registrant__idx ON gitrepository (registrant);
+CREATE INDEX gitrepository__reviewer__idx ON gitrepository (reviewer);
+
+INSERT INTO LaunchpadDatabaseRevision VALUES (2209, 61, 8);