]> git.mxchange.org Git - quix0rs-gnu-social.git/commitdiff
Fix index on notice for efficient querying of notice(s) by order for a profile.
authorBrion Vibber <brion@pobox.com>
Thu, 12 Nov 2009 19:08:43 +0000 (11:08 -0800)
committerBrion Vibber <brion@pobox.com>
Thu, 12 Nov 2009 19:08:43 +0000 (11:08 -0800)
Should resolve performance problem with Profile::getCurrentNotice()

db/08to09.sql
db/08to09_pg.sql
db/statusnet.sql
db/statusnet_pg.sql

index 1d37a759d8429ca1b347e6439553394caba30f5a..028fe56a484fbcb08549950637789173c8315a05 100644 (file)
@@ -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);
index 004c77b365dd657ab14eeaa612f4fd38317ef6cd..fe9eccb2a95eb01e2c0b633c0d0f9c1ba889e347 100644 (file)
@@ -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);
index 2983c67cfc00c9543b942bfced0d21ae14d7c99f..732aded5a59c96022cc97eae23bd84a93bb40e8c 100644 (file)
@@ -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),
index 392a6a5f3c29fada0afa2dec63e7671999fe7278..7b0e5313ceac86560de1953612a772180c7e038a 100644 (file)
@@ -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 (