launchpad-reviewers team mailing list archive
-
launchpad-reviewers team
-
Mailing list archive
-
Message #24391
[Merge] ~wgrant/launchpad:bprdc-ios into launchpad:master
William Grant has proposed merging ~wgrant/launchpad:bprdc-ios into launchpad:master.
Commit message:
Index BinaryPackageReleaseDownloadCount for index-only scans
Requested reviews:
Launchpad code reviewers (launchpad-reviewers)
For more details, see:
https://code.launchpad.net/~wgrant/launchpad/+git/launchpad/+merge/379942
Creating an index on binarypackagereleasedownloadcount (archive, binary_package_release, day, count) allows BinaryPackagePublishingHistory.getDailyDownloadTotals and Archive.getPackageDownloadCount to execute as index-only scans and not touch the heap at all. One sample query drops from 2789 page reads to 177.
Should be applied hot.
--
Your team Launchpad code reviewers is requested to review the proposed merge of ~wgrant/launchpad:bprdc-ios into launchpad:master.
diff --git a/database/schema/patch-2210-01-4.sql b/database/schema/patch-2210-01-4.sql
new file mode 100644
index 0000000..4ec5185
--- /dev/null
+++ b/database/schema/patch-2210-01-4.sql
@@ -0,0 +1,8 @@
+-- Copyright 2020 Canonical Ltd. This software is licensed under the
+-- GNU Affero General Public License version 3 (see the file LICENSE).
+
+CREATE INDEX binarypackagereleasedownloadcount__index_only_scan__idx
+ ON binarypackagereleasedownloadcount (
+ archive, binary_package_release, day, count);
+
+INSERT INTO LaunchpadDatabaseRevision VALUES (2210, 01, 4);