From 737fe763471bcb6ebd95c318363308a33e28e889 Mon Sep 17 00:00:00 2001
From: Brion Vibber <brion@pobox.com>
Date: Tue, 10 Nov 2009 08:47:54 -0800
Subject: Performance fix for subscription/subscriber lists based on feedback
 from ops.

Extended subscription table indexes for subscriber and subscribed to include the created field, which is used to sort for display. This lets us skip a filesort and do the join much more efficiently.
Alter table from 08to09.sql needs to be run manually (though no ill effects if you forget other than not getting the perf improvement).
---
 db/08to09.sql | 6 ++++++
 1 file changed, 6 insertions(+)

(limited to 'db/08to09.sql')

diff --git a/db/08to09.sql b/db/08to09.sql
index e6842225b..1d37a759d 100644
--- a/db/08to09.sql
+++ b/db/08to09.sql
@@ -45,3 +45,9 @@ create table login_token (
 alter table fave
     drop index fave_user_id_idx,
     add index fave_user_id_idx (user_id,modified);
+
+alter table subscription
+    drop index subscription_subscriber_idx,
+    add index subscription_subscriber_idx (subscriber,created),
+    drop index subscription_subscribed_idx,
+    add index subscription_subscribed_idx (subscribed,created);
-- 
cgit v1.2.3-54-g00ecf

