We are no longer offering accounts on this server. Consider https://gitlab.freedesktop.org/ as a place to host projects.

Commit 81fa5158 authored by Brion Vibber's avatar Brion Vibber

Fix index on notice for efficient querying of notice(s) by order for a profile.

Should resolve performance problem with Profile::getCurrentNotice()
parent d8fe5224
......@@ -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);
......@@ -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);
......@@ -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),
......
......@@ -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 (
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment