Issue 9906: Hopefully finally fixes the speed issues

This commit is contained in:
Michael 2021-03-09 21:21:33 +00:00
parent 5863fd881d
commit 1e56cee2c5
3 changed files with 5 additions and 3 deletions

View File

@ -1,6 +1,6 @@
-- ------------------------------------------
-- Friendica 2021.03-rc (Red Hot Poker)
-- DB_UPDATE_VERSION 1409
-- DB_UPDATE_VERSION 1410
-- ------------------------------------------
@ -1132,6 +1132,7 @@ CREATE TABLE IF NOT EXISTS `post-user` (
INDEX `uid_contactid` (`uid`,`contact-id`),
INDEX `uid_unseen_contactid` (`uid`,`unseen`,`contact-id`),
INDEX `uid_unseen` (`uid`,`unseen`),
INDEX `uid_hidden_uri-id` (`uid`,`hidden`,`uri-id`),
FOREIGN KEY (`uri-id`) REFERENCES `item-uri` (`id`) ON UPDATE RESTRICT ON DELETE CASCADE,
FOREIGN KEY (`parent-uri-id`) REFERENCES `item-uri` (`id`) ON UPDATE RESTRICT ON DELETE CASCADE,
FOREIGN KEY (`thr-parent-id`) REFERENCES `item-uri` (`id`) ON UPDATE RESTRICT ON DELETE CASCADE,

View File

@ -313,7 +313,7 @@ class Post
AND (NOT `causer-blocked` OR `causer-id` = ? OR `causer-id` IS NULL) AND NOT `contact-blocked`
AND ((NOT `contact-readonly` AND NOT `contact-pending` AND (`contact-rel` IN (?, ?)))
OR `self` OR `gravity` != ? OR `contact-uid` = ?)
AND NOT EXISTS (SELECT `uri-id` FROM `post-user` USE INDEX (`uid_uri-id`) WHERE `uid` = ? AND `uri-id` = `" . $view . "`.`uri-id` AND `hidden`)
AND NOT EXISTS (SELECT `uri-id` FROM `post-user` WHERE `uid` = ? AND `uri-id` = `" . $view . "`.`uri-id` AND `hidden`)
AND NOT EXISTS (SELECT `cid` FROM `user-contact` WHERE `uid` = ? AND `cid` = `author-id` AND `blocked`)
AND NOT EXISTS (SELECT `cid` FROM `user-contact` WHERE `uid` = ? AND `cid` = `owner-id` AND `blocked`)
AND NOT EXISTS (SELECT `cid` FROM `user-contact` WHERE `uid` = ? AND `cid` = `author-id` AND `ignored` AND `gravity` = ?)

View File

@ -55,7 +55,7 @@
use Friendica\Database\DBA;
if (!defined('DB_UPDATE_VERSION')) {
define('DB_UPDATE_VERSION', 1409);
define('DB_UPDATE_VERSION', 1410);
}
return [
@ -1184,6 +1184,7 @@ return [
"uid_contactid" => ["uid", "contact-id"],
"uid_unseen_contactid" => ["uid", "unseen", "contact-id"],
"uid_unseen" => ["uid", "unseen"],
"uid_hidden_uri-id" => ["uid", "hidden", "uri-id"],
],
],
"post-thread-user" => [