Merge pull request #10023 from annando/issue-9906-again

Issue 9906: Hopefully fixes the speed issues
This commit is contained in:
Hypolite Petovan 2021-03-09 18:13:19 -05:00 committed by GitHub
commit c1047d6997
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
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" => [