Merge pull request #12145 from annando/parent-post
Performance improvements in public timeline
This commit is contained in:
commit
cae2e17436
4 changed files with 7 additions and 23 deletions
18
database.sql
18
database.sql
|
@ -1,6 +1,6 @@
|
||||||
-- ------------------------------------------
|
-- ------------------------------------------
|
||||||
-- Friendica 2022.12-dev (Giant Rhubarb)
|
-- Friendica 2022.12-dev (Giant Rhubarb)
|
||||||
-- DB_UPDATE_VERSION 1487
|
-- DB_UPDATE_VERSION 1488
|
||||||
-- ------------------------------------------
|
-- ------------------------------------------
|
||||||
|
|
||||||
|
|
||||||
|
@ -1953,9 +1953,7 @@ CREATE VIEW `post-user-view` AS SELECT
|
||||||
`parent-post-author`.`url` AS `parent-author-link`,
|
`parent-post-author`.`url` AS `parent-author-link`,
|
||||||
`parent-post-author`.`name` AS `parent-author-name`,
|
`parent-post-author`.`name` AS `parent-author-name`,
|
||||||
`parent-post-author`.`nick` AS `parent-author-nick`,
|
`parent-post-author`.`nick` AS `parent-author-nick`,
|
||||||
`parent-post-author`.`network` AS `parent-author-network`,
|
`parent-post-author`.`network` AS `parent-author-network`
|
||||||
`parent-post-author`.`blocked` AS `parent-author-blocked`,
|
|
||||||
`parent-post-author`.`hidden` AS `parent-author-hidden`
|
|
||||||
FROM `post-user`
|
FROM `post-user`
|
||||||
STRAIGHT_JOIN `post-thread-user` ON `post-thread-user`.`uri-id` = `post-user`.`parent-uri-id` AND `post-thread-user`.`uid` = `post-user`.`uid`
|
STRAIGHT_JOIN `post-thread-user` ON `post-thread-user`.`uri-id` = `post-user`.`parent-uri-id` AND `post-thread-user`.`uid` = `post-user`.`uid`
|
||||||
STRAIGHT_JOIN `contact` ON `contact`.`id` = `post-user`.`contact-id`
|
STRAIGHT_JOIN `contact` ON `contact`.`id` = `post-user`.`contact-id`
|
||||||
|
@ -2132,9 +2130,7 @@ CREATE VIEW `post-thread-user-view` AS SELECT
|
||||||
`parent-post`.`author-id` AS `parent-author-id`,
|
`parent-post`.`author-id` AS `parent-author-id`,
|
||||||
`parent-post-author`.`url` AS `parent-author-link`,
|
`parent-post-author`.`url` AS `parent-author-link`,
|
||||||
`parent-post-author`.`name` AS `parent-author-name`,
|
`parent-post-author`.`name` AS `parent-author-name`,
|
||||||
`parent-post-author`.`network` AS `parent-author-network`,
|
`parent-post-author`.`network` AS `parent-author-network`
|
||||||
`parent-post-author`.`blocked` AS `parent-author-blocked`,
|
|
||||||
`parent-post-author`.`hidden` AS `parent-author-hidden`
|
|
||||||
FROM `post-thread-user`
|
FROM `post-thread-user`
|
||||||
INNER JOIN `post-user` ON `post-user`.`id` = `post-thread-user`.`post-user-id`
|
INNER JOIN `post-user` ON `post-user`.`id` = `post-thread-user`.`post-user-id`
|
||||||
STRAIGHT_JOIN `contact` ON `contact`.`id` = `post-thread-user`.`contact-id`
|
STRAIGHT_JOIN `contact` ON `contact`.`id` = `post-thread-user`.`contact-id`
|
||||||
|
@ -2278,9 +2274,7 @@ CREATE VIEW `post-view` AS SELECT
|
||||||
`parent-post`.`author-id` AS `parent-author-id`,
|
`parent-post`.`author-id` AS `parent-author-id`,
|
||||||
`parent-post-author`.`url` AS `parent-author-link`,
|
`parent-post-author`.`url` AS `parent-author-link`,
|
||||||
`parent-post-author`.`name` AS `parent-author-name`,
|
`parent-post-author`.`name` AS `parent-author-name`,
|
||||||
`parent-post-author`.`network` AS `parent-author-network`,
|
`parent-post-author`.`network` AS `parent-author-network`
|
||||||
`parent-post-author`.`blocked` AS `parent-author-blocked`,
|
|
||||||
`parent-post-author`.`hidden` AS `parent-author-hidden`
|
|
||||||
FROM `post`
|
FROM `post`
|
||||||
STRAIGHT_JOIN `post-thread` ON `post-thread`.`uri-id` = `post`.`parent-uri-id`
|
STRAIGHT_JOIN `post-thread` ON `post-thread`.`uri-id` = `post`.`parent-uri-id`
|
||||||
STRAIGHT_JOIN `contact` AS `author` ON `author`.`id` = `post`.`author-id`
|
STRAIGHT_JOIN `contact` AS `author` ON `author`.`id` = `post`.`author-id`
|
||||||
|
@ -2420,9 +2414,7 @@ CREATE VIEW `post-thread-view` AS SELECT
|
||||||
`parent-post`.`author-id` AS `parent-author-id`,
|
`parent-post`.`author-id` AS `parent-author-id`,
|
||||||
`parent-post-author`.`url` AS `parent-author-link`,
|
`parent-post-author`.`url` AS `parent-author-link`,
|
||||||
`parent-post-author`.`name` AS `parent-author-name`,
|
`parent-post-author`.`name` AS `parent-author-name`,
|
||||||
`parent-post-author`.`network` AS `parent-author-network`,
|
`parent-post-author`.`network` AS `parent-author-network`
|
||||||
`parent-post-author`.`blocked` AS `parent-author-blocked`,
|
|
||||||
`parent-post-author`.`hidden` AS `parent-author-hidden`
|
|
||||||
FROM `post-thread`
|
FROM `post-thread`
|
||||||
INNER JOIN `post` ON `post`.`uri-id` = `post-thread`.`uri-id`
|
INNER JOIN `post` ON `post`.`uri-id` = `post-thread`.`uri-id`
|
||||||
STRAIGHT_JOIN `contact` AS `author` ON `author`.`id` = `post-thread`.`author-id`
|
STRAIGHT_JOIN `contact` AS `author` ON `author`.`id` = `post-thread`.`author-id`
|
||||||
|
|
|
@ -58,7 +58,7 @@ class PublicTimeline extends BaseApi
|
||||||
$params = ['order' => ['uri-id' => true], 'limit' => $request['limit']];
|
$params = ['order' => ['uri-id' => true], 'limit' => $request['limit']];
|
||||||
|
|
||||||
$condition = ['gravity' => [Item::GRAVITY_PARENT, Item::GRAVITY_COMMENT], 'private' => Item::PUBLIC,
|
$condition = ['gravity' => [Item::GRAVITY_PARENT, Item::GRAVITY_COMMENT], 'private' => Item::PUBLIC,
|
||||||
'network' => Protocol::FEDERATED, 'parent-author-blocked' => false, 'parent-author-hidden' => false];
|
'network' => Protocol::FEDERATED, 'author-blocked' => false, 'author-hidden' => false];
|
||||||
|
|
||||||
if ($request['local']) {
|
if ($request['local']) {
|
||||||
$condition = DBA::mergeConditions($condition, ["`uri-id` IN (SELECT `uri-id` FROM `post-user` WHERE `origin`)"]);
|
$condition = DBA::mergeConditions($condition, ["`uri-id` IN (SELECT `uri-id` FROM `post-user` WHERE `origin`)"]);
|
||||||
|
|
|
@ -55,7 +55,7 @@
|
||||||
use Friendica\Database\DBA;
|
use Friendica\Database\DBA;
|
||||||
|
|
||||||
if (!defined('DB_UPDATE_VERSION')) {
|
if (!defined('DB_UPDATE_VERSION')) {
|
||||||
define('DB_UPDATE_VERSION', 1487);
|
define('DB_UPDATE_VERSION', 1488);
|
||||||
}
|
}
|
||||||
|
|
||||||
return [
|
return [
|
||||||
|
|
|
@ -213,8 +213,6 @@
|
||||||
"parent-author-name" => ["parent-post-author", "name"],
|
"parent-author-name" => ["parent-post-author", "name"],
|
||||||
"parent-author-nick" => ["parent-post-author", "nick"],
|
"parent-author-nick" => ["parent-post-author", "nick"],
|
||||||
"parent-author-network" => ["parent-post-author", "network"],
|
"parent-author-network" => ["parent-post-author", "network"],
|
||||||
"parent-author-blocked" => ["parent-post-author", "blocked"],
|
|
||||||
"parent-author-hidden" => ["parent-post-author", "hidden"],
|
|
||||||
],
|
],
|
||||||
"query" => "FROM `post-user`
|
"query" => "FROM `post-user`
|
||||||
STRAIGHT_JOIN `post-thread-user` ON `post-thread-user`.`uri-id` = `post-user`.`parent-uri-id` AND `post-thread-user`.`uid` = `post-user`.`uid`
|
STRAIGHT_JOIN `post-thread-user` ON `post-thread-user`.`uri-id` = `post-user`.`parent-uri-id` AND `post-thread-user`.`uid` = `post-user`.`uid`
|
||||||
|
@ -391,8 +389,6 @@
|
||||||
"parent-author-link" => ["parent-post-author", "url"],
|
"parent-author-link" => ["parent-post-author", "url"],
|
||||||
"parent-author-name" => ["parent-post-author", "name"],
|
"parent-author-name" => ["parent-post-author", "name"],
|
||||||
"parent-author-network" => ["parent-post-author", "network"],
|
"parent-author-network" => ["parent-post-author", "network"],
|
||||||
"parent-author-blocked" => ["parent-post-author", "blocked"],
|
|
||||||
"parent-author-hidden" => ["parent-post-author", "hidden"],
|
|
||||||
],
|
],
|
||||||
"query" => "FROM `post-thread-user`
|
"query" => "FROM `post-thread-user`
|
||||||
INNER JOIN `post-user` ON `post-user`.`id` = `post-thread-user`.`post-user-id`
|
INNER JOIN `post-user` ON `post-user`.`id` = `post-thread-user`.`post-user-id`
|
||||||
|
@ -536,8 +532,6 @@
|
||||||
"parent-author-link" => ["parent-post-author", "url"],
|
"parent-author-link" => ["parent-post-author", "url"],
|
||||||
"parent-author-name" => ["parent-post-author", "name"],
|
"parent-author-name" => ["parent-post-author", "name"],
|
||||||
"parent-author-network" => ["parent-post-author", "network"],
|
"parent-author-network" => ["parent-post-author", "network"],
|
||||||
"parent-author-blocked" => ["parent-post-author", "blocked"],
|
|
||||||
"parent-author-hidden" => ["parent-post-author", "hidden"],
|
|
||||||
],
|
],
|
||||||
"query" => "FROM `post`
|
"query" => "FROM `post`
|
||||||
STRAIGHT_JOIN `post-thread` ON `post-thread`.`uri-id` = `post`.`parent-uri-id`
|
STRAIGHT_JOIN `post-thread` ON `post-thread`.`uri-id` = `post`.`parent-uri-id`
|
||||||
|
@ -677,8 +671,6 @@
|
||||||
"parent-author-link" => ["parent-post-author", "url"],
|
"parent-author-link" => ["parent-post-author", "url"],
|
||||||
"parent-author-name" => ["parent-post-author", "name"],
|
"parent-author-name" => ["parent-post-author", "name"],
|
||||||
"parent-author-network" => ["parent-post-author", "network"],
|
"parent-author-network" => ["parent-post-author", "network"],
|
||||||
"parent-author-blocked" => ["parent-post-author", "blocked"],
|
|
||||||
"parent-author-hidden" => ["parent-post-author", "hidden"],
|
|
||||||
],
|
],
|
||||||
"query" => "FROM `post-thread`
|
"query" => "FROM `post-thread`
|
||||||
INNER JOIN `post` ON `post`.`uri-id` = `post-thread`.`uri-id`
|
INNER JOIN `post` ON `post`.`uri-id` = `post-thread`.`uri-id`
|
||||||
|
|
Loading…
Reference in a new issue