summaryrefslogtreecommitdiff
path: root/db/08to09_pg.sql
diff options
context:
space:
mode:
authorBrion Vibber <brion@pobox.com>2009-11-10 08:47:54 -0800
committerBrion Vibber <brion@pobox.com>2009-11-10 08:47:54 -0800
commit737fe763471bcb6ebd95c318363308a33e28e889 (patch)
treeb9094b0adda4e666fa9480f547a80b0a54e027b5 /db/08to09_pg.sql
parent9d0687b0559095f270a55af3467c53ad29bfd4c7 (diff)
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).
Diffstat (limited to 'db/08to09_pg.sql')
-rw-r--r--db/08to09_pg.sql6
1 files changed, 6 insertions, 0 deletions
diff --git a/db/08to09_pg.sql b/db/08to09_pg.sql
index 956c4dee5..004c77b36 100644
--- a/db/08to09_pg.sql
+++ b/db/08to09_pg.sql
@@ -51,3 +51,9 @@ create table login_token (
alter table fave
drop index fave_user_id_idx,
add index fave_user_id_idx using btree(user_id,modified);
+
+alter table subscription
+ drop index subscription_subscriber_idx,
+ add index subscription_subscriber_idx using btree(subscriber,created),
+ drop index subscription_subscribed_idx,
+ add index subscription_subscribed_idx using btree(subscribed,created);