Merge lp:~wgrant/launchpad/flatten-bfj-6.5-db-more-indices into lp:launchpad

Proposed by William Grant
Status: Merged
Approved by: William Grant
Approved revision: no longer in the source branch.
Merged at revision: 16484
Proposed branch: lp:~wgrant/launchpad/flatten-bfj-6.5-db-more-indices
Merge into: lp:launchpad
Diff against target: 58 lines (+54/-0)
1 file modified
database/schema/patch-2209-41-4.sql (+54/-0)
To merge this branch: bzr merge lp:~wgrant/launchpad/flatten-bfj-6.5-db-more-indices
Reviewer Review Type Date Requested Status
William Grant db Approve
Review via email: mp+147018@code.launchpad.net

Commit message

Add D/DS/DAS:+builds, BPB.estimateDuration and SPN BPB search indices.

Description of the change

Add D/DS/DAS:+builds, BPB.estimateDuration and SPN BPB search indices.

To post a comment you must log in.
Revision history for this message
William Grant (wgrant) :
review: Approve (code)
Revision history for this message
William Grant (wgrant) :
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-41-4.sql'
2--- database/schema/patch-2209-41-4.sql 1970-01-01 00:00:00 +0000
3+++ database/schema/patch-2209-41-4.sql 2013-02-07 05:09:24 +0000
4@@ -0,0 +1,54 @@
5+-- Copyright 2013 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+-- Distribution:+builds
11+CREATE INDEX binarypackagebuild__distro__status__date_finished__id__idx
12+ ON binarypackagebuild (distribution, status, date_finished DESC, id)
13+ WHERE is_distro_archive;
14+CREATE INDEX binarypackagebuild__distro__status__id__idx
15+ ON binarypackagebuild (distribution, status, id)
16+ WHERE is_distro_archive;
17+CREATE INDEX binarypackagebuild__distro__id__idx
18+ ON binarypackagebuild (distribution, id)
19+ WHERE is_distro_archive;
20+
21+-- DistroSeries:+builds
22+CREATE INDEX binarypackagebuild__ds__status__date_finished__id__idx
23+ ON binarypackagebuild (distro_series, status, date_finished DESC, id)
24+ WHERE is_distro_archive;
25+CREATE INDEX binarypackagebuild__ds__status__id__idx
26+ ON binarypackagebuild (distro_series, status, id)
27+ WHERE is_distro_archive;
28+CREATE INDEX binarypackagebuild__ds__id__idx
29+ ON binarypackagebuild (distro_series, id)
30+ WHERE is_distro_archive;
31+
32+-- DistroArchSeries:+builds
33+CREATE INDEX binarypackagebuild__das__status__date_finished__id__2__idx
34+ ON binarypackagebuild (distro_arch_series, status, date_finished DESC, id)
35+ WHERE is_distro_archive;
36+CREATE INDEX binarypackagebuild__das__status__id__2__idx
37+ ON binarypackagebuild (distro_arch_series, status, id)
38+ WHERE is_distro_archive;
39+CREATE INDEX binarypackagebuild__das__id__2__idx
40+ ON binarypackagebuild (distro_arch_series, id)
41+ WHERE is_distro_archive;
42+
43+-- BinaryPackageBuild.estimateDuration, and general (archive, DAS) queries.
44+CREATE INDEX binarypackagebuild__archive__das__spn__status__finished__idx
45+ ON binarypackagebuild (archive, distro_arch_series, source_package_name,
46+ status, date_finished, id);
47+
48+-- General queries by SPN.
49+CREATE INDEX binarypackagebuild__source_package_name__idx
50+ ON binarypackagebuild (source_package_name);
51+
52+-- And grabbing BPRs/SPRs by (name, version).
53+CREATE INDEX binarypackagerelease__binarypackagename__version__idx
54+ ON binarypackagerelease (binarypackagename, version);
55+CREATE INDEX sourcepackagerelease__sourcepackagename__version__idx
56+ ON sourcepackagerelease (sourcepackagename, version);
57+
58+INSERT INTO LaunchpadDatabaseRevision VALUES (2209, 41, 4);