From 9d0687b0559095f270a55af3467c53ad29bfd4c7 Mon Sep 17 00:00:00 2001 From: Brion Vibber 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/08to09_pg.sql | 3 +++ 1 file changed, 3 insertions(+) (limited to 'db/08to09_pg.sql') diff --git a/db/08to09_pg.sql b/db/08to09_pg.sql index 197fcabfd..956c4dee5 100644 --- a/db/08to09_pg.sql +++ b/db/08to09_pg.sql @@ -48,3 +48,6 @@ create table login_token ( constraint primary key (user_id) ); +alter table fave + drop index fave_user_id_idx, + add index fave_user_id_idx using btree(user_id,modified); -- cgit v1.2.3-54-g00ecf