diff options
author | Brion Vibber <brion@pobox.com> | 2009-11-12 11:08:43 -0800 |
---|---|---|
committer | Brion Vibber <brion@pobox.com> | 2009-11-12 11:08:43 -0800 |
commit | 81fa515881e42afe55379befa4e7d93313c90891 (patch) | |
tree | b5d16054787cb85f64488ec647decd503e3f4306 | |
parent | d8fe5224cb5628f1a281c7498a516e89992f6474 (diff) |
Fix index on notice for efficient querying of notice(s) by order for a profile.
Should resolve performance problem with Profile::getCurrentNotice()
-rw-r--r-- | db/08to09.sql | 4 | ||||
-rw-r--r-- | db/08to09_pg.sql | 4 | ||||
-rw-r--r-- | db/statusnet.sql | 2 | ||||
-rw-r--r-- | db/statusnet_pg.sql | 2 |
4 files changed, 10 insertions, 2 deletions
diff --git a/db/08to09.sql b/db/08to09.sql index 1d37a759d..028fe56a4 100644 --- a/db/08to09.sql +++ b/db/08to09.sql @@ -51,3 +51,7 @@ alter table subscription add index subscription_subscriber_idx (subscriber,created), drop index subscription_subscribed_idx, add index subscription_subscribed_idx (subscribed,created); + +alter table notice + drop index notice_profile_id_idx, + add index notice_profile_id_idx (profile_id,created,id); diff --git a/db/08to09_pg.sql b/db/08to09_pg.sql index 004c77b36..fe9eccb2a 100644 --- a/db/08to09_pg.sql +++ b/db/08to09_pg.sql @@ -57,3 +57,7 @@ alter table subscription add index subscription_subscriber_idx using btree(subscriber,created), drop index subscription_subscribed_idx, add index subscription_subscribed_idx using btree(subscribed,created); + +alter table notice + drop index notice_profile_id_idx, + add index notice_profile_id_idx using btree(profile_id,created,id); diff --git a/db/statusnet.sql b/db/statusnet.sql index 2983c67cf..732aded5a 100644 --- a/db/statusnet.sql +++ b/db/statusnet.sql @@ -130,7 +130,7 @@ create table notice ( location_id integer comment 'location id if possible', location_ns integer comment 'namespace for location', - index notice_profile_id_idx (profile_id), + index notice_profile_id_idx (profile_id,created,id), index notice_conversation_idx (conversation), index notice_created_idx (created), index notice_replyto_idx (reply_to), diff --git a/db/statusnet_pg.sql b/db/statusnet_pg.sql index 392a6a5f3..7b0e5313c 100644 --- a/db/statusnet_pg.sql +++ b/db/statusnet_pg.sql @@ -137,7 +137,7 @@ create table notice ( /* FULLTEXT(content) */ ); -create index notice_profile_id_idx on notice using btree(profile_id); +create index notice_profile_id_idx on notice using btree(profile_id,created,id); create index notice_created_idx on notice using btree(created); create table notice_source ( |