add combined index for item.uid and item.item_unseen. this speeds up notifications by a magnitude.
This commit is contained in:
@@ -650,8 +650,9 @@ CREATE TABLE IF NOT EXISTS `item` (
|
||||
KEY `created` (`created`),
|
||||
KEY `edited` (`edited`),
|
||||
KEY `received` (`received`),
|
||||
KEY `uid_commented` (`uid`,`commented`),
|
||||
KEY `uid_created` (`uid`,`created`),
|
||||
KEY `uid_commented` (`uid`, `commented`),
|
||||
KEY `uid_created` (`uid`, `created`),
|
||||
KEY `uid_item_unseen` (`uid`, `item_unseen`);
|
||||
KEY `aid` (`aid`),
|
||||
KEY `owner_xchan` (`owner_xchan`),
|
||||
KEY `author_xchan` (`author_xchan`),
|
||||
|
@@ -621,6 +621,7 @@ create index "item_edited" on item ("edited");
|
||||
create index "item_received" on item ("received");
|
||||
create index "item_uid_commented" on item ("uid","commented");
|
||||
create index "item_uid_created" on item ("uid","created");
|
||||
create index "item_uid_unseen" on item ("uid","item_unseen");
|
||||
create index "item_changed" on item ("changed");
|
||||
create index "item_comments_closed" on item ("comments_closed");
|
||||
create index "item_aid" on item ("aid");
|
||||
|
@@ -1,6 +1,6 @@
|
||||
<?php
|
||||
|
||||
define( 'UPDATE_VERSION' , 1193 );
|
||||
define( 'UPDATE_VERSION' , 1194 );
|
||||
|
||||
/**
|
||||
*
|
||||
@@ -2978,3 +2978,17 @@ function update_r1192() {
|
||||
return UPDATE_SUCCESS;
|
||||
return UPDATE_FAILED;
|
||||
}
|
||||
|
||||
function update_r1193() {
|
||||
|
||||
if(ACTIVE_DBTYPE == DBTYPE_POSTGRES) {
|
||||
$r1 = q("CREATE INDEX item_uid_unseen ON item (uid, item_unseen)");
|
||||
}
|
||||
else {
|
||||
$r1 = q("ALTER TABLE item ADD INDEX uid_item_unseen (uid, item_unseen);");
|
||||
}
|
||||
|
||||
if($r1)
|
||||
return UPDATE_SUCCESS;
|
||||
return UPDATE_FAILED;
|
||||
}
|
||||
|
Reference in New Issue
Block a user