diff options
author | Mario Vavti <mario@mariovavti.com> | 2017-09-01 21:27:59 +0200 |
---|---|---|
committer | Mario Vavti <mario@mariovavti.com> | 2017-09-01 21:27:59 +0200 |
commit | e935473c5c05a40194c110fbb024825a30ca5a4b (patch) | |
tree | 0795a3d546c8294d2f14a64e2d3e206cbe4b8e05 | |
parent | 3af3b36db3ef1ab0f8b5987a13d9adca482d0952 (diff) | |
download | volse-hubzilla-e935473c5c05a40194c110fbb024825a30ca5a4b.tar.gz volse-hubzilla-e935473c5c05a40194c110fbb024825a30ca5a4b.tar.bz2 volse-hubzilla-e935473c5c05a40194c110fbb024825a30ca5a4b.zip |
add combined index for item.uid and item.item_unseen. this speeds up notifications by a magnitude.
-rw-r--r-- | Zotlabs/Web/WebServer.php | 2 | ||||
-rwxr-xr-x | boot.php | 2 | ||||
-rw-r--r-- | install/schema_mysql.sql | 5 | ||||
-rw-r--r-- | install/schema_postgres.sql | 1 | ||||
-rw-r--r-- | install/update.php | 16 | ||||
-rw-r--r-- | view/js/main.js | 8 | ||||
-rwxr-xr-x | view/tpl/nav.tpl | 4 |
7 files changed, 27 insertions, 11 deletions
diff --git a/Zotlabs/Web/WebServer.php b/Zotlabs/Web/WebServer.php index 4e8dc6786..a66384c40 100644 --- a/Zotlabs/Web/WebServer.php +++ b/Zotlabs/Web/WebServer.php @@ -137,4 +137,4 @@ class WebServer { killme(); } -}
\ No newline at end of file +} @@ -52,7 +52,7 @@ define ( 'PLATFORM_NAME', 'hubzilla' ); define ( 'STD_VERSION', '2.7.2' ); define ( 'ZOT_REVISION', '1.3' ); -define ( 'DB_UPDATE_VERSION', 1193 ); +define ( 'DB_UPDATE_VERSION', 1194 ); define ( 'PROJECT_BASE', __DIR__ ); diff --git a/install/schema_mysql.sql b/install/schema_mysql.sql index 9e2e401b5..a9950ce21 100644 --- a/install/schema_mysql.sql +++ b/install/schema_mysql.sql @@ -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`), diff --git a/install/schema_postgres.sql b/install/schema_postgres.sql index 0bc783692..381c262a7 100644 --- a/install/schema_postgres.sql +++ b/install/schema_postgres.sql @@ -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"); diff --git a/install/update.php b/install/update.php index 8798a3d69..b99e4dd9d 100644 --- a/install/update.php +++ b/install/update.php @@ -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; +} diff --git a/view/js/main.js b/view/js/main.js index 41be3da59..531f999f9 100644 --- a/view/js/main.js +++ b/view/js/main.js @@ -281,7 +281,7 @@ function closeMenu(theID) { function markRead(notifType) { $.get('ping?f=&markRead='+notifType); if(timer) clearTimeout(timer); - $('#' + notifType + '-update').html(''); + $('.' + notifType + '-button').hide(); timer = setTimeout(NavUpdate,2000); } @@ -446,13 +446,13 @@ function NavUpdate() { if(data.network == 0) { data.network = ''; - $('.net-update, .net-button').hide(); + $('.network-update, .network-button').hide(); document.title = savedTitle; } else { - $('.net-update, .net-button').show(); + $('.network-update, .network-button').show(); document.title = '(' + data.network + ') ' + savedTitle; } - $('.net-update').html(data.network); + $('.network-update').html(data.network); if(data.pubs == 0) { data.pubs = ''; diff --git a/view/tpl/nav.tpl b/view/tpl/nav.tpl index ae354e371..f21017076 100755 --- a/view/tpl/nav.tpl +++ b/view/tpl/nav.tpl @@ -75,10 +75,10 @@ <div class="collapse navbar-collapse" id="navbar-collapse-1"> <ul class="navbar-nav mr-auto"> {{if $nav.network}} - <li class="nav-item dropdown net-button" style="display: none;"> + <li class="nav-item dropdown network-button" style="display: none;"> <a class="nav-link" href="#" title="{{$nav.network.3}}" id="{{$nav.network.4}}" data-toggle="dropdown" rel="#nav-network-menu"> <i class="fa fa-fw fa-th"></i> - <span class="badge badge-pill badge-secondary net-update"></span> + <span class="badge badge-pill badge-secondary network-update"></span> </a> <div id="nav-network-menu" class="dropdown-menu" rel="network"> <a class="dropdown-item" id="nav-network-see-all" href="{{$nav.network.all.0}}">{{$nav.network.all.1}}</a> |