← Back to team overview

launchpad-reviewers team mailing list archive

[Merge] lp:~stub/launchpad/db-cleanups into lp:launchpad/db-devel

 

Stuart Bishop has proposed merging lp:~stub/launchpad/db-cleanups into lp:launchpad/db-devel with lp:~stub/launchpad/pending-db-changes as a prerequisite.

Requested reviews:
  Launchpad code reviewers (launchpad-reviewers)
Related bugs:
  Bug #306201 in Launchpad itself: "LP uses GIST indices which are slow to query compared to GIN indices"
  https://bugs.launchpad.net/launchpad/+bug/306201

For more details, see:
https://code.launchpad.net/~stub/launchpad/db-cleanups/+merge/108145

= Summary =

GIN indexes are faster for all of our use cases than GiST.

== Proposed fix ==

Replace all the GiST indexes with GIN indexes.
-- 
https://code.launchpad.net/~stub/launchpad/db-cleanups/+merge/108145
Your team Launchpad code reviewers is requested to review the proposed merge of lp:~stub/launchpad/db-cleanups into lp:launchpad/db-devel.
=== added file 'database/schema/patch-2209-21-2.sql'
--- database/schema/patch-2209-21-2.sql	1970-01-01 00:00:00 +0000
+++ database/schema/patch-2209-21-2.sql	2012-05-31 11:26:25 +0000
@@ -0,0 +1,24 @@
+SET client_min_messages = ERROR;
+
+CREATE INDEX archive__fti__idx ON archive USING GIN (fti);
+CREATE INDEX message__fti__idx ON message USING GIN (fti);
+CREATE INDEX faq__fti__idx ON faq USING GIN (fti);
+CREATE INDEX question__fti__idx ON question USING GIN (fti);
+CREATE INDEX binarypackagerelease__fti__idx
+    ON binarypackagerelease USING GIN (fti);
+CREATE INDEX distroseriespackagecache__fti__idx
+    ON distroseriespackagecache USING GIN (fti);
+CREATE INDEX specification__fti__idx ON specification USING GIN (fti);
+CREATE INDEX messagechunk__fti__idx ON messagechunk USING GIN (fti);
+CREATE INDEX project__fti__idx ON project USING GIN (fti);
+CREATE INDEX cve__fti__idx ON cve USING GIN (fti);
+CREATE INDEX person__fti__idx ON person USING GIN (fti);
+CREATE INDEX bug__fti__idx ON bug USING GIN (fti);
+CREATE INDEX distributionsourcepackagecache__fti__idx
+    ON distributionsourcepackagecache USING GIN (fti);
+CREATE INDEX productreleasefile__fti__idx
+    ON productreleasefile USING GIN (fti);
+CREATE INDEX product__fti__idx ON product USING GIN (fti);
+CREATE INDEX distribution__fti__idx ON distribution USING GIN (fti);
+
+INSERT INTO LaunchpadDatabaseRevision VALUES (2209, 21, 2);

=== added file 'database/schema/patch-2209-21-3.sql'
--- database/schema/patch-2209-21-3.sql	1970-01-01 00:00:00 +0000
+++ database/schema/patch-2209-21-3.sql	2012-05-31 11:26:25 +0000
@@ -0,0 +1,20 @@
+SET client_min_messages = ERROR;
+
+DROP INDEX archive_fti;
+DROP INDEX message_fti;
+DROP INDEX faq_fti;
+DROP INDEX question_fti;
+DROP INDEX binarypackagerelease_fti;
+DROP INDEX distroseriespackagecache_fti;
+DROP INDEX specification_fti;
+DROP INDEX messagechunk_fti;
+DROP INDEX project_fti;
+DROP INDEX cve_fti;
+DROP INDEX person_fti;
+DROP INDEX bug_fti;
+DROP INDEX distributionsourcepackagecache_fti;
+DROP INDEX productreleasefile_fti;
+DROP INDEX product_fti;
+DROP INDEX distribution_fti;
+
+INSERT INTO LaunchpadDatabaseRevision VALUES (2209, 21, 3);


Follow ups