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.)
This commit is contained in:
parent
486dbe6aef
commit
9d0687b055
@ -42,3 +42,6 @@ create table login_token (
|
|||||||
constraint primary key (user_id)
|
constraint primary key (user_id)
|
||||||
) ENGINE=InnoDB CHARACTER SET utf8 COLLATE utf8_bin;
|
) 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);
|
||||||
|
@ -48,3 +48,6 @@ create table login_token (
|
|||||||
constraint primary key (user_id)
|
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);
|
||||||
|
@ -165,7 +165,7 @@ create table fave (
|
|||||||
|
|
||||||
constraint primary key (notice_id, user_id),
|
constraint primary key (notice_id, user_id),
|
||||||
index fave_notice_id_idx (notice_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)
|
index fave_modified_idx (modified)
|
||||||
|
|
||||||
) ENGINE=InnoDB CHARACTER SET utf8 COLLATE utf8_bin;
|
) ENGINE=InnoDB CHARACTER SET utf8 COLLATE utf8_bin;
|
||||||
|
@ -171,7 +171,7 @@ create table fave (
|
|||||||
|
|
||||||
);
|
);
|
||||||
create index fave_notice_id_idx on fave using btree(notice_id);
|
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);
|
create index fave_modified_idx on fave using btree(modified);
|
||||||
|
|
||||||
/* tables for OAuth */
|
/* tables for OAuth */
|
||||||
|
Loading…
Reference in New Issue
Block a user