From 4949be60a899105aa7f125227f2767af87afceb2 Mon Sep 17 00:00:00 2001 From: Michael Date: Thu, 1 Feb 2018 00:29:47 +0000 Subject: [PATCH] Improved query speed --- boot.php | 2 +- database.sql | 4 ++-- mod/community.php | 7 ++----- src/Database/DBStructure.php | 2 +- 4 files changed, 6 insertions(+), 9 deletions(-) diff --git a/boot.php b/boot.php index 98db95227f..732816d1b9 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', 1247); +define('DB_UPDATE_VERSION', 1248); define('NEW_UPDATE_ROUTINE_VERSION', 1170); /** diff --git a/database.sql b/database.sql index d6a869b56b..7433213107 100644 --- a/database.sql +++ b/database.sql @@ -1,6 +1,6 @@ -- ------------------------------------------ -- Friendica 3.6-dev (Asparagus) --- DB_UPDATE_VERSION 1246 +-- DB_UPDATE_VERSION 1248 -- ------------------------------------------ @@ -982,7 +982,7 @@ CREATE TABLE IF NOT EXISTS `thread` ( INDEX `uid_created` (`uid`,`created`), INDEX `uid_commented` (`uid`,`commented`), INDEX `uid_wall_created` (`uid`,`wall`,`created`), - INDEX `private_wall_commented` (`private`,`wall`,`commented`) + INDEX `private_wall_origin_commented` (`private`,`wall`,`origin`,`commented`) ) DEFAULT COLLATE utf8mb4_general_ci; -- diff --git a/mod/community.php b/mod/community.php index f1b747917c..29fcd44794 100644 --- a/mod/community.php +++ b/mod/community.php @@ -183,14 +183,11 @@ function community_content(App $a, $update = 0) function community_getitems($start, $itemspage, $content) { if ($content == 'local') { - $r = dba::p("SELECT " . item_fieldlists() . " FROM `thread` + $r = dba::p("SELECT `item`.`uri`, `item`.`author-link` FROM `thread` INNER JOIN `user` ON `user`.`uid` = `thread`.`uid` AND NOT `user`.`hidewall` INNER JOIN `item` ON `item`.`id` = `thread`.`iid` - AND `item`.`allow_cid` = '' AND `item`.`allow_gid` = '' - AND `item`.`deny_cid` = '' AND `item`.`deny_gid` = ''" . - item_joins() . " AND `contact`.`self` WHERE `thread`.`visible` AND NOT `thread`.`deleted` AND NOT `thread`.`moderated` - AND NOT `thread`.`private` AND `thread`.`wall` + AND NOT `thread`.`private` AND `thread`.`wall` AND `thread`.`origin` ORDER BY `thread`.`commented` DESC LIMIT " . intval($start) . ", " . intval($itemspage) ); return dba::inArray($r); diff --git a/src/Database/DBStructure.php b/src/Database/DBStructure.php index 169d84e34d..6c4ceec48e 100644 --- a/src/Database/DBStructure.php +++ b/src/Database/DBStructure.php @@ -1686,7 +1686,7 @@ class DBStructure "uid_created" => ["uid","created"], "uid_commented" => ["uid","commented"], "uid_wall_created" => ["uid","wall","created"], - "private_wall_commented" => ["private","wall","commented"], + "private_wall_origin_commented" => ["private","wall","origin","commented"], ] ]; $database["tokens"] = [ -- 2.39.5