Improve the performance of API timeline calls

This commit is contained in:
Michael 2023-10-18 08:11:36 +00:00
parent 2cd18fd4bf
commit 1c67be8db0
8 changed files with 147 additions and 26 deletions

View file

@ -56,7 +56,7 @@ use Friendica\Database\DBA;
// This file is required several times during the test in DbaDefinition which justifies this condition
if (!defined('DB_UPDATE_VERSION')) {
define('DB_UPDATE_VERSION', 1537);
define('DB_UPDATE_VERSION', 1538);
}
return [

View file

@ -87,6 +87,49 @@
INNER JOIN `contact` ON `group_member`.`contact-id` = `contact`.`id`
INNER JOIN `group` ON `group_member`.`gid` = `group`.`id`"
],
"post-timeline-view" => [
"fields" => [
"uid" => ["post-user", "uid"],
"uri-id" => ["post-user", "uri-id"],
"gravity" => ["post-user", "gravity"],
"created" => ["post-user", "created"],
"edited" => ["post-user", "edited"],
"commented" => ["post-thread-user", "commented"],
"received" => ["post-user", "received"],
"changed" => ["post-thread-user", "changed"],
"private" => ["post-user", "private"],
"visible" => ["post-user", "visible"],
"deleted" => ["post-user", "deleted"],
"origin" => ["post-user", "origin"],
"global" => ["post-user", "global"],
"network" => ["post-user", "network"],
"protocol" => ["post-user", "protocol"],
"vid" => ["post-user", "vid"],
"contact-id" => ["post-user", "contact-id"],
"contact-blocked" => ["contact", "blocked"],
"contact-readonly" => ["contact", "readonly"],
"contact-pending" => ["contact", "pending"],
"contact-rel" => ["contact", "rel"],
"contact-uid" => ["contact", "uid"],
"self" => ["contact", "self"],
"author-id" => ["post-user", "author-id"],
"author-blocked" => ["author", "blocked"],
"author-hidden" => ["author", "hidden"],
"author-gsid" => ["author", "gsid"],
"owner-id" => ["post-user", "owner-id"],
"owner-blocked" => ["owner", "blocked"],
"owner-gsid" => ["owner", "gsid"],
"causer-id" => ["post-user", "causer-id"],
"causer-blocked" => ["causer", "blocked"],
"causer-gsid" => ["causer", "gsid"],
],
"query" => "FROM `post-user`
LEFT 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` AS `author` ON `author`.`id` = `post-user`.`author-id`
STRAIGHT_JOIN `contact` AS `owner` ON `owner`.`id` = `post-user`.`owner-id`
LEFT JOIN `contact` AS `causer` ON `causer`.`id` = `post-user`.`causer-id`"
],
"post-user-view" => [
"fields" => [
"id" => ["post-user", "id"],