summaryrefslogtreecommitdiff
path: root/db
diff options
context:
space:
mode:
Diffstat (limited to 'db')
-rw-r--r--db/08to09.sql9
-rw-r--r--db/08to09_pg.sql9
-rw-r--r--db/statusnet.sql6
-rw-r--r--db/statusnet_pg.sql6
4 files changed, 24 insertions, 6 deletions
diff --git a/db/08to09.sql b/db/08to09.sql
index a0e37f0f1..1d37a759d 100644
--- a/db/08to09.sql
+++ b/db/08to09.sql
@@ -42,3 +42,12 @@ create table login_token (
constraint primary key (user_id)
) ENGINE=InnoDB CHARACTER SET utf8 COLLATE utf8_bin;
+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);
diff --git a/db/08to09_pg.sql b/db/08to09_pg.sql
index 197fcabfd..004c77b36 100644
--- a/db/08to09_pg.sql
+++ b/db/08to09_pg.sql
@@ -48,3 +48,12 @@ 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);
+
+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);
diff --git a/db/statusnet.sql b/db/statusnet.sql
index 3ed4e2c48..2983c67cf 100644
--- a/db/statusnet.sql
+++ b/db/statusnet.sql
@@ -107,8 +107,8 @@ create table subscription (
modified timestamp comment 'date this record was modified',
constraint primary key (subscriber, subscribed),
- index subscription_subscriber_idx (subscriber),
- index subscription_subscribed_idx (subscribed),
+ index subscription_subscriber_idx (subscriber, created),
+ index subscription_subscribed_idx (subscribed, created),
index subscription_token_idx (token)
) ENGINE=InnoDB CHARACTER SET utf8 COLLATE utf8_bin;
@@ -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;
diff --git a/db/statusnet_pg.sql b/db/statusnet_pg.sql
index 0e5e96c32..392a6a5f3 100644
--- a/db/statusnet_pg.sql
+++ b/db/statusnet_pg.sql
@@ -115,8 +115,8 @@ create table subscription (
primary key (subscriber, subscribed)
);
-create index subscription_subscriber_idx on subscription using btree(subscriber);
-create index subscription_subscribed_idx on subscription using btree(subscribed);
+create index subscription_subscriber_idx on subscription using btree(subscriber,created);
+create index subscription_subscribed_idx on subscription using btree(subscribed,created);
create sequence notice_seq;
create table notice (
@@ -171,7 +171,7 @@ create table fave (
);
create index fave_notice_id_idx on fave using btree(notice_id);
-create index fave_user_id_idx on fave using btree(user_id);
+create index fave_user_id_idx on fave using btree(user_id,modified);
create index fave_modified_idx on fave using btree(modified);
/* tables for OAuth */