From fe68e99c7c1b52172e3008c3015622883fad5315 Mon Sep 17 00:00:00 2001 From: Michael Date: Mon, 26 Feb 2018 06:59:32 +0000 Subject: [PATCH] The tag query should be much faster now --- boot.php | 2 +- database.sql | 3 ++- mod/network.php | 2 +- src/Database/DBStructure.php | 1 + 4 files changed, 5 insertions(+), 3 deletions(-) diff --git a/boot.php b/boot.php index 2a8bf1806..472814a6d 100644 --- a/boot.php +++ b/boot.php @@ -39,7 +39,7 @@ define('FRIENDICA_PLATFORM', 'Friendica'); define('FRIENDICA_CODENAME', 'Asparagus'); define('FRIENDICA_VERSION', '3.6-dev'); define('DFRN_PROTOCOL_VERSION', '2.23'); -define('DB_UPDATE_VERSION', 1254); +define('DB_UPDATE_VERSION', 1255); define('NEW_UPDATE_ROUTINE_VERSION', 1170); /** diff --git a/database.sql b/database.sql index a1c3e31e4..4275c3831 100644 --- a/database.sql +++ b/database.sql @@ -1,6 +1,6 @@ -- ------------------------------------------ -- Friendica 3.6-dev (Asparagus) --- DB_UPDATE_VERSION 1254 +-- DB_UPDATE_VERSION 1255 -- ------------------------------------------ @@ -512,6 +512,7 @@ CREATE TABLE IF NOT EXISTS `item` ( INDEX `uid_id` (`uid`,`id`), INDEX `uid_contactid_id` (`uid`,`contact-id`,`id`), INDEX `uid_created` (`uid`,`created`), + INDEX `uid_commented` (`uid`,`commented`), INDEX `uid_unseen_contactid` (`uid`,`unseen`,`contact-id`), INDEX `uid_network_received` (`uid`,`network`,`received`), INDEX `uid_network_commented` (`uid`,`network`,`commented`), diff --git a/mod/network.php b/mod/network.php index 924aa16b6..5e8f5b760 100644 --- a/mod/network.php +++ b/mod/network.php @@ -818,7 +818,7 @@ function networkThreadedView(App $a, $update = 0) } $items = dba::p("SELECT `item`.`uri`, `item`.`id` AS `item_id`, `item`.$ordering AS `order_date` FROM `item` - INNER JOIN (SELECT `oid` FROM `term` WHERE `term` IN + STRAIGHT_JOIN (SELECT `oid` FROM `term` WHERE `term` IN (SELECT SUBSTR(`term`, 2) FROM `search` WHERE `uid` = ? AND `term` LIKE '#%') AND `otype` = ? AND `type` = ? AND `uid` = 0) AS `term` ON `item`.`id` = `term`.`oid` STRAIGHT_JOIN `contact` ON `contact`.`id` = `item`.`author-id` diff --git a/src/Database/DBStructure.php b/src/Database/DBStructure.php index 0b5eca1ae..f4a88871d 100644 --- a/src/Database/DBStructure.php +++ b/src/Database/DBStructure.php @@ -1191,6 +1191,7 @@ class DBStructure "uid_id" => ["uid","id"], "uid_contactid_id" => ["uid","contact-id","id"], "uid_created" => ["uid","created"], + "uid_commented" => ["uid","commented"], "uid_unseen_contactid" => ["uid","unseen","contact-id"], "uid_network_received" => ["uid","network","received"], "uid_network_commented" => ["uid","network","commented"],