API: Speed improvements when fetching posts

This commit is contained in:
Michael 2022-06-10 18:49:03 +00:00
parent 86837ddb4a
commit 7e747b2f41
9 changed files with 140 additions and 104 deletions

View file

@ -1,6 +1,6 @@
-- ------------------------------------------
-- Friendica 2022.05-rc (Siberian Iris)
-- DB_UPDATE_VERSION 1468
-- DB_UPDATE_VERSION 1469
-- ------------------------------------------
@ -1752,6 +1752,7 @@ CREATE VIEW `post-user-view` AS SELECT
`post-content`.`target` AS `target`,
`post-content`.`resource-id` AS `resource-id`,
`post-user`.`contact-id` AS `contact-id`,
`contact`.`uri-id` AS `contact-uri-id`,
`contact`.`url` AS `contact-link`,
`contact`.`addr` AS `contact-addr`,
`contact`.`name` AS `contact-name`,
@ -1776,6 +1777,7 @@ CREATE VIEW `post-user-view` AS SELECT
`contact`.`avatar-date` AS `avatar-date`,
`contact`.`thumb` AS `thumb`,
`post-user`.`author-id` AS `author-id`,
`author`.`uri-id` AS `author-uri-id`,
`author`.`url` AS `author-link`,
`author`.`addr` AS `author-addr`,
IF (`contact`.`url` = `author`.`url` AND `contact`.`name` != '', `contact`.`name`, `author`.`name`) AS `author-name`,
@ -1786,8 +1788,8 @@ CREATE VIEW `post-user-view` AS SELECT
`author`.`hidden` AS `author-hidden`,
`author`.`updated` AS `author-updated`,
`author`.`gsid` AS `author-gsid`,
`author`.`uri-id` AS `author-uri-id`,
`post-user`.`owner-id` AS `owner-id`,
`owner`.`uri-id` AS `owner-uri-id`,
`owner`.`url` AS `owner-link`,
`owner`.`addr` AS `owner-addr`,
IF (`contact`.`url` = `owner`.`url` AND `contact`.`name` != '', `contact`.`name`, `owner`.`name`) AS `owner-name`,
@ -1799,6 +1801,7 @@ CREATE VIEW `post-user-view` AS SELECT
`owner`.`updated` AS `owner-updated`,
`owner`.`contact-type` AS `owner-contact-type`,
`post-user`.`causer-id` AS `causer-id`,
`causer`.`uri-id` AS `causer-uri-id`,
`causer`.`url` AS `causer-link`,
`causer`.`addr` AS `causer-addr`,
`causer`.`name` AS `causer-name`,
@ -1923,6 +1926,7 @@ CREATE VIEW `post-thread-user-view` AS SELECT
`post-content`.`target` AS `target`,
`post-content`.`resource-id` AS `resource-id`,
`post-thread-user`.`contact-id` AS `contact-id`,
`contact`.`uri-id` AS `contact-uri-id`,
`contact`.`url` AS `contact-link`,
`contact`.`addr` AS `contact-addr`,
`contact`.`name` AS `contact-name`,
@ -1947,6 +1951,7 @@ CREATE VIEW `post-thread-user-view` AS SELECT
`contact`.`avatar-date` AS `avatar-date`,
`contact`.`thumb` AS `thumb`,
`post-thread-user`.`author-id` AS `author-id`,
`author`.`uri-id` AS `author-uri-id`,
`author`.`url` AS `author-link`,
`author`.`addr` AS `author-addr`,
IF (`contact`.`url` = `author`.`url` AND `contact`.`name` != '', `contact`.`name`, `author`.`name`) AS `author-name`,
@ -1957,8 +1962,8 @@ CREATE VIEW `post-thread-user-view` AS SELECT
`author`.`hidden` AS `author-hidden`,
`author`.`updated` AS `author-updated`,
`author`.`gsid` AS `author-gsid`,
`author`.`uri-id` AS `author-uri-id`,
`post-thread-user`.`owner-id` AS `owner-id`,
`owner`.`uri-id` AS `owner-uri-id`,
`owner`.`url` AS `owner-link`,
`owner`.`addr` AS `owner-addr`,
IF (`contact`.`url` = `owner`.`url` AND `contact`.`name` != '', `contact`.`name`, `owner`.`name`) AS `owner-name`,
@ -1970,6 +1975,7 @@ CREATE VIEW `post-thread-user-view` AS SELECT
`owner`.`updated` AS `owner-updated`,
`owner`.`contact-type` AS `owner-contact-type`,
`post-thread-user`.`causer-id` AS `causer-id`,
`causer`.`uri-id` AS `causer-uri-id`,
`causer`.`url` AS `causer-link`,
`causer`.`addr` AS `causer-addr`,
`causer`.`name` AS `causer-name`,
@ -2080,6 +2086,7 @@ CREATE VIEW `post-view` AS SELECT
`post-content`.`target` AS `target`,
`post-content`.`resource-id` AS `resource-id`,
`post`.`author-id` AS `contact-id`,
`author`.`uri-id` AS `contact-uri-id`,
`author`.`url` AS `contact-link`,
`author`.`addr` AS `contact-addr`,
`author`.`name` AS `contact-name`,
@ -2104,6 +2111,7 @@ CREATE VIEW `post-view` AS SELECT
`author`.`avatar-date` AS `avatar-date`,
`author`.`thumb` AS `thumb`,
`post`.`author-id` AS `author-id`,
`author`.`uri-id` AS `author-uri-id`,
`author`.`url` AS `author-link`,
`author`.`addr` AS `author-addr`,
`author`.`name` AS `author-name`,
@ -2114,8 +2122,8 @@ CREATE VIEW `post-view` AS SELECT
`author`.`hidden` AS `author-hidden`,
`author`.`updated` AS `author-updated`,
`author`.`gsid` AS `author-gsid`,
`author`.`uri-id` AS `author-uri-id`,
`post`.`owner-id` AS `owner-id`,
`owner`.`uri-id` AS `owner-uri-id`,
`owner`.`url` AS `owner-link`,
`owner`.`addr` AS `owner-addr`,
`owner`.`name` AS `owner-name`,
@ -2127,6 +2135,7 @@ CREATE VIEW `post-view` AS SELECT
`owner`.`updated` AS `owner-updated`,
`owner`.`contact-type` AS `owner-contact-type`,
`post`.`causer-id` AS `causer-id`,
`causer`.`uri-id` AS `causer-uri-id`,
`causer`.`url` AS `causer-link`,
`causer`.`addr` AS `causer-addr`,
`causer`.`name` AS `causer-name`,
@ -2213,6 +2222,7 @@ CREATE VIEW `post-thread-view` AS SELECT
`post-content`.`target` AS `target`,
`post-content`.`resource-id` AS `resource-id`,
`post-thread`.`author-id` AS `contact-id`,
`author`.`uri-id` AS `contact-uri-id`,
`author`.`url` AS `contact-link`,
`author`.`addr` AS `contact-addr`,
`author`.`name` AS `contact-name`,
@ -2237,6 +2247,7 @@ CREATE VIEW `post-thread-view` AS SELECT
`author`.`avatar-date` AS `avatar-date`,
`author`.`thumb` AS `thumb`,
`post-thread`.`author-id` AS `author-id`,
`author`.`uri-id` AS `author-uri-id`,
`author`.`url` AS `author-link`,
`author`.`addr` AS `author-addr`,
`author`.`name` AS `author-name`,
@ -2247,8 +2258,8 @@ CREATE VIEW `post-thread-view` AS SELECT
`author`.`hidden` AS `author-hidden`,
`author`.`updated` AS `author-updated`,
`author`.`gsid` AS `author-gsid`,
`author`.`uri-id` AS `author-uri-id`,
`post-thread`.`owner-id` AS `owner-id`,
`owner`.`uri-id` AS `owner-uri-id`,
`owner`.`url` AS `owner-link`,
`owner`.`addr` AS `owner-addr`,
`owner`.`name` AS `owner-name`,
@ -2260,6 +2271,7 @@ CREATE VIEW `post-thread-view` AS SELECT
`owner`.`updated` AS `owner-updated`,
`owner`.`contact-type` AS `owner-contact-type`,
`post-thread`.`causer-id` AS `causer-id`,
`causer`.`uri-id` AS `causer-uri-id`,
`causer`.`url` AS `causer-link`,
`causer`.`addr` AS `causer-addr`,
`causer`.`name` AS `causer-name`,
@ -2705,6 +2717,9 @@ CREATE VIEW `account-user-view` AS SELECT
`fcontact`.`notify` AS `diaspora-notify`,
`fcontact`.`poll` AS `diaspora-poll`,
`fcontact`.`alias` AS `diaspora-alias`,
`fcontact`.`interacting_count` AS `diaspora-interacting_count`,
`fcontact`.`interacted_count` AS `diaspora-interacted_count`,
`fcontact`.`post_count` AS `diaspora-post_count`,
`apcontact`.`uuid` AS `ap-uuid`,
`apcontact`.`type` AS `ap-type`,
`apcontact`.`following` AS `ap-following`,