From 9d0687b0559095f270a55af3467c53ad29bfd4c7 Mon Sep 17 00:00:00 2001
From: Brion Vibber <brion@pobox.com>
Date: Tue, 10 Nov 2009 08:23:24 -0800
Subject: Adjusting indexes to make favorites query more efficient, based on
 feedback from ops.

fave_user_id_idx index changed from (user_id) to (user_id,modified), so the timestamp ordering can be done straight from the index while we're looking up the user's notices.
Added to 08to09.sql and 08to09_pg.sql; may need to be run manually by folks doing development.
(No harm if you don't update it, the favorites tab/rss feed will just stay inefficent.)
---
 db/statusnet.sql | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

(limited to 'db/statusnet.sql')

diff --git a/db/statusnet.sql b/db/statusnet.sql
index 3ed4e2c48..510c8866e 100644
--- a/db/statusnet.sql
+++ b/db/statusnet.sql
@@ -165,7 +165,7 @@ create table fave (
 
     constraint primary key (notice_id, user_id),
     index fave_notice_id_idx (notice_id),
-    index fave_user_id_idx (user_id),
+    index fave_user_id_idx (user_id,modified),
     index fave_modified_idx (modified)
 
 ) ENGINE=InnoDB CHARACTER SET utf8 COLLATE utf8_bin;
-- 
cgit v1.2.3-54-g00ecf

