summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBrion Vibber <brion@pobox.com>2010-12-17 16:12:44 -0800
committerBrion Vibber <brion@pobox.com>2010-12-17 16:12:44 -0800
commit146d6b8b735472a2ae4c2f8d2653243492651399 (patch)
tree80f80bbc4a748b155e7ad1508f0328293795aada
parentfb65d5901d586a13886b81d84de8959b67b6aa9e (diff)
Sorting index fix for role lookups: adds profile_role_role_created_profile_id_idx index on profile_role
-rw-r--r--db/096to097.sql3
-rw-r--r--db/statusnet.sql3
2 files changed, 5 insertions, 1 deletions
diff --git a/db/096to097.sql b/db/096to097.sql
index 88cbea457..875077e8b 100644
--- a/db/096to097.sql
+++ b/db/096to097.sql
@@ -18,3 +18,6 @@ alter table reply add index reply_profile_id_modified_notice_id_idx (profile_id,
-- Needed for sorting group messages by timestamp
alter table group_inbox add index group_inbox_group_id_created_notice_id_idx (group_id, created, notice_id);
+
+-- Helps make some reverse role lookups more efficient if there's a lot of assigned accounts
+alter table profile_role add index profile_role_role_created_profile_id_idx (role, created, profile_id);
diff --git a/db/statusnet.sql b/db/statusnet.sql
index 8b38f9ffe..0c1697a7e 100644
--- a/db/statusnet.sql
+++ b/db/statusnet.sql
@@ -627,7 +627,8 @@ create table profile_role (
role varchar(32) not null comment 'string representing the role',
created datetime not null comment 'date the role was granted',
- constraint primary key (profile_id, role)
+ constraint primary key (profile_id, role),
+ index profile_role_role_created_profile_id_idx (role, created, profile_id)
) ENGINE=InnoDB CHARACTER SET utf8 COLLATE utf8_bin;