Increased performance when fetching the parent
This commit is contained in:
parent
68c0408af5
commit
89b6c4c73f
|
@ -63,7 +63,7 @@
|
||||||
"id" => ["post-user", "id"],
|
"id" => ["post-user", "id"],
|
||||||
"post-user-id" => ["post-user", "id"],
|
"post-user-id" => ["post-user", "id"],
|
||||||
"uid" => ["post-user", "uid"],
|
"uid" => ["post-user", "uid"],
|
||||||
"parent" => ["parent-post", "id"],
|
"parent" => ["post-thread-user", "post-user-id"],
|
||||||
"uri" => ["item-uri", "uri"],
|
"uri" => ["item-uri", "uri"],
|
||||||
"uri-id" => ["post-user", "uri-id"],
|
"uri-id" => ["post-user", "uri-id"],
|
||||||
"parent-uri" => ["parent-item-uri", "uri"],
|
"parent-uri" => ["parent-item-uri", "uri"],
|
||||||
|
@ -206,8 +206,8 @@
|
||||||
"has-media" => "EXISTS(SELECT `id` FROM `post-media` WHERE `post-media`.`uri-id` = `post-user`.`uri-id`)",
|
"has-media" => "EXISTS(SELECT `id` FROM `post-media` WHERE `post-media`.`uri-id` = `post-user`.`uri-id`)",
|
||||||
"signed_text" => ["diaspora-interaction", "interaction"],
|
"signed_text" => ["diaspora-interaction", "interaction"],
|
||||||
"parent-guid" => ["parent-item-uri", "guid"],
|
"parent-guid" => ["parent-item-uri", "guid"],
|
||||||
"parent-network" => ["parent-post", "network"],
|
"parent-network" => ["post-thread-user", "network"],
|
||||||
"parent-author-id" => ["parent-post", "author-id"],
|
"parent-author-id" => ["post-thread-user", "author-id"],
|
||||||
"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-nick" => ["parent-post-author", "nick"],
|
"parent-author-nick" => ["parent-post-author", "nick"],
|
||||||
|
@ -232,15 +232,14 @@
|
||||||
LEFT JOIN `post-delivery-data` ON `post-delivery-data`.`uri-id` = `post-user`.`uri-id` AND `post-user`.`origin`
|
LEFT JOIN `post-delivery-data` ON `post-delivery-data`.`uri-id` = `post-user`.`uri-id` AND `post-user`.`origin`
|
||||||
LEFT JOIN `post-question` ON `post-question`.`uri-id` = `post-user`.`uri-id`
|
LEFT JOIN `post-question` ON `post-question`.`uri-id` = `post-user`.`uri-id`
|
||||||
LEFT JOIN `permissionset` ON `permissionset`.`id` = `post-user`.`psid`
|
LEFT JOIN `permissionset` ON `permissionset`.`id` = `post-user`.`psid`
|
||||||
LEFT JOIN `post-user` AS `parent-post` ON `parent-post`.`uri-id` = `post-user`.`parent-uri-id` AND `parent-post`.`uid` = `post-user`.`uid`
|
LEFT JOIN `contact` AS `parent-post-author` ON `parent-post-author`.`id` = `post-thread-user`.`author-id`"
|
||||||
LEFT JOIN `contact` AS `parent-post-author` ON `parent-post-author`.`id` = `parent-post`.`author-id`"
|
|
||||||
],
|
],
|
||||||
"post-thread-user-view" => [
|
"post-thread-user-view" => [
|
||||||
"fields" => [
|
"fields" => [
|
||||||
"id" => ["post-user", "id"],
|
"id" => ["post-user", "id"],
|
||||||
"post-user-id" => ["post-user", "id"],
|
"post-user-id" => ["post-user", "id"],
|
||||||
"uid" => ["post-thread-user", "uid"],
|
"uid" => ["post-thread-user", "uid"],
|
||||||
"parent" => ["parent-post", "id"],
|
"parent" => ["post-thread-user", "post-user-id"],
|
||||||
"uri" => ["item-uri", "uri"],
|
"uri" => ["item-uri", "uri"],
|
||||||
"uri-id" => ["post-thread-user", "uri-id"],
|
"uri-id" => ["post-thread-user", "uri-id"],
|
||||||
"parent-uri" => ["parent-item-uri", "uri"],
|
"parent-uri" => ["parent-item-uri", "uri"],
|
||||||
|
@ -382,11 +381,12 @@
|
||||||
"has-media" => "EXISTS(SELECT `id` FROM `post-media` WHERE `post-media`.`uri-id` = `post-thread-user`.`uri-id`)",
|
"has-media" => "EXISTS(SELECT `id` FROM `post-media` WHERE `post-media`.`uri-id` = `post-thread-user`.`uri-id`)",
|
||||||
"signed_text" => ["diaspora-interaction", "interaction"],
|
"signed_text" => ["diaspora-interaction", "interaction"],
|
||||||
"parent-guid" => ["parent-item-uri", "guid"],
|
"parent-guid" => ["parent-item-uri", "guid"],
|
||||||
"parent-network" => ["parent-post", "network"],
|
"parent-network" => ["post-thread-user", "network"],
|
||||||
"parent-author-id" => ["parent-post", "author-id"],
|
"parent-author-id" => ["post-thread-user", "author-id"],
|
||||||
"parent-author-link" => ["parent-post-author", "url"],
|
"parent-author-link" => ["author", "url"],
|
||||||
"parent-author-name" => ["parent-post-author", "name"],
|
"parent-author-name" => ["author", "name"],
|
||||||
"parent-author-network" => ["parent-post-author", "network"],
|
"parent-author-nick" => ["author", "nick"],
|
||||||
|
"parent-author-network" => ["author", "network"],
|
||||||
],
|
],
|
||||||
"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`
|
||||||
|
@ -406,9 +406,7 @@
|
||||||
LEFT JOIN `item-uri` AS `quote-item-uri` ON `quote-item-uri`.`id` = `post-content`.`quote-uri-id`
|
LEFT JOIN `item-uri` AS `quote-item-uri` ON `quote-item-uri`.`id` = `post-content`.`quote-uri-id`
|
||||||
LEFT JOIN `post-delivery-data` ON `post-delivery-data`.`uri-id` = `post-thread-user`.`uri-id` AND `post-thread-user`.`origin`
|
LEFT JOIN `post-delivery-data` ON `post-delivery-data`.`uri-id` = `post-thread-user`.`uri-id` AND `post-thread-user`.`origin`
|
||||||
LEFT JOIN `post-question` ON `post-question`.`uri-id` = `post-thread-user`.`uri-id`
|
LEFT JOIN `post-question` ON `post-question`.`uri-id` = `post-thread-user`.`uri-id`
|
||||||
LEFT JOIN `permissionset` ON `permissionset`.`id` = `post-thread-user`.`psid`
|
LEFT JOIN `permissionset` ON `permissionset`.`id` = `post-thread-user`.`psid`"
|
||||||
LEFT JOIN `post-user` AS `parent-post` ON `parent-post`.`uri-id` = `post-user`.`parent-uri-id` AND `parent-post`.`uid` = `post-thread-user`.`uid`
|
|
||||||
LEFT JOIN `contact` AS `parent-post-author` ON `parent-post-author`.`id` = `parent-post`.`author-id`"
|
|
||||||
],
|
],
|
||||||
"post-view" => [
|
"post-view" => [
|
||||||
"fields" => [
|
"fields" => [
|
||||||
|
@ -524,10 +522,11 @@
|
||||||
"has-media" => "EXISTS(SELECT `id` FROM `post-media` WHERE `post-media`.`uri-id` = `post`.`uri-id`)",
|
"has-media" => "EXISTS(SELECT `id` FROM `post-media` WHERE `post-media`.`uri-id` = `post`.`uri-id`)",
|
||||||
"signed_text" => ["diaspora-interaction", "interaction"],
|
"signed_text" => ["diaspora-interaction", "interaction"],
|
||||||
"parent-guid" => ["parent-item-uri", "guid"],
|
"parent-guid" => ["parent-item-uri", "guid"],
|
||||||
"parent-network" => ["parent-post", "network"],
|
"parent-network" => ["post-thread", "network"],
|
||||||
"parent-author-id" => ["parent-post", "author-id"],
|
"parent-author-id" => ["post-thread", "author-id"],
|
||||||
"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-nick" => ["parent-post-author", "nick"],
|
||||||
"parent-author-network" => ["parent-post-author", "network"],
|
"parent-author-network" => ["parent-post-author", "network"],
|
||||||
],
|
],
|
||||||
"query" => "FROM `post`
|
"query" => "FROM `post`
|
||||||
|
@ -545,8 +544,7 @@
|
||||||
LEFT JOIN `post-content` ON `post-content`.`uri-id` = `post`.`uri-id`
|
LEFT JOIN `post-content` ON `post-content`.`uri-id` = `post`.`uri-id`
|
||||||
LEFT JOIN `item-uri` AS `quote-item-uri` ON `quote-item-uri`.`id` = `post-content`.`quote-uri-id`
|
LEFT JOIN `item-uri` AS `quote-item-uri` ON `quote-item-uri`.`id` = `post-content`.`quote-uri-id`
|
||||||
LEFT JOIN `post-question` ON `post-question`.`uri-id` = `post`.`uri-id`
|
LEFT JOIN `post-question` ON `post-question`.`uri-id` = `post`.`uri-id`
|
||||||
LEFT JOIN `post` AS `parent-post` ON `parent-post`.`uri-id` = `post`.`parent-uri-id`
|
LEFT JOIN `contact` AS `parent-post-author` ON `parent-post-author`.`id` = `post-thread`.`author-id`"
|
||||||
LEFT JOIN `contact` AS `parent-post-author` ON `parent-post-author`.`id` = `parent-post`.`author-id`"
|
|
||||||
],
|
],
|
||||||
"post-thread-view" => [
|
"post-thread-view" => [
|
||||||
"fields" => [
|
"fields" => [
|
||||||
|
@ -664,11 +662,12 @@
|
||||||
"total-actors" => "(SELECT COUNT(DISTINCT(`author-id`)) FROM `post` WHERE `parent-uri-id` = `post-thread`.`uri-id` AND `gravity` = 6)",
|
"total-actors" => "(SELECT COUNT(DISTINCT(`author-id`)) FROM `post` WHERE `parent-uri-id` = `post-thread`.`uri-id` AND `gravity` = 6)",
|
||||||
"signed_text" => ["diaspora-interaction", "interaction"],
|
"signed_text" => ["diaspora-interaction", "interaction"],
|
||||||
"parent-guid" => ["parent-item-uri", "guid"],
|
"parent-guid" => ["parent-item-uri", "guid"],
|
||||||
"parent-network" => ["parent-post", "network"],
|
"parent-network" => ["post-thread", "network"],
|
||||||
"parent-author-id" => ["parent-post", "author-id"],
|
"parent-author-id" => ["post-thread", "author-id"],
|
||||||
"parent-author-link" => ["parent-post-author", "url"],
|
"parent-author-link" => ["author", "url"],
|
||||||
"parent-author-name" => ["parent-post-author", "name"],
|
"parent-author-name" => ["author", "name"],
|
||||||
"parent-author-network" => ["parent-post-author", "network"],
|
"parent-author-nick" => ["author", "nick"],
|
||||||
|
"parent-author-network" => ["author", "network"],
|
||||||
],
|
],
|
||||||
"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`
|
||||||
|
@ -684,9 +683,7 @@
|
||||||
LEFT JOIN `diaspora-interaction` ON `diaspora-interaction`.`uri-id` = `post-thread`.`uri-id`
|
LEFT JOIN `diaspora-interaction` ON `diaspora-interaction`.`uri-id` = `post-thread`.`uri-id`
|
||||||
LEFT JOIN `post-content` ON `post-content`.`uri-id` = `post-thread`.`uri-id`
|
LEFT JOIN `post-content` ON `post-content`.`uri-id` = `post-thread`.`uri-id`
|
||||||
LEFT JOIN `item-uri` AS `quote-item-uri` ON `quote-item-uri`.`id` = `post-content`.`quote-uri-id`
|
LEFT JOIN `item-uri` AS `quote-item-uri` ON `quote-item-uri`.`id` = `post-content`.`quote-uri-id`
|
||||||
LEFT JOIN `post-question` ON `post-question`.`uri-id` = `post-thread`.`uri-id`
|
LEFT JOIN `post-question` ON `post-question`.`uri-id` = `post-thread`.`uri-id`"
|
||||||
LEFT JOIN `post` AS `parent-post` ON `parent-post`.`uri-id` = `post`.`parent-uri-id`
|
|
||||||
LEFT JOIN `contact` AS `parent-post-author` ON `parent-post-author`.`id` = `parent-post`.`author-id`"
|
|
||||||
],
|
],
|
||||||
"category-view" => [
|
"category-view" => [
|
||||||
"fields" => [
|
"fields" => [
|
||||||
|
@ -752,7 +749,7 @@
|
||||||
"network-item-view" => [
|
"network-item-view" => [
|
||||||
"fields" => [
|
"fields" => [
|
||||||
"uri-id" => ["post-user", "uri-id"],
|
"uri-id" => ["post-user", "uri-id"],
|
||||||
"parent" => ["parent-post", "id"],
|
"parent" => ["post-thread-user", "post-user-id"],
|
||||||
"received" => ["post-user", "received"],
|
"received" => ["post-user", "received"],
|
||||||
"commented" => ["post-thread-user", "commented"],
|
"commented" => ["post-thread-user", "commented"],
|
||||||
"created" => ["post-user", "created"],
|
"created" => ["post-user", "created"],
|
||||||
|
@ -771,7 +768,6 @@
|
||||||
LEFT JOIN `user-contact` AS `author` ON `author`.`uid` = `post-thread-user`.`uid` AND `author`.`cid` = `post-thread-user`.`author-id`
|
LEFT JOIN `user-contact` AS `author` ON `author`.`uid` = `post-thread-user`.`uid` AND `author`.`cid` = `post-thread-user`.`author-id`
|
||||||
LEFT JOIN `user-contact` AS `owner` ON `owner`.`uid` = `post-thread-user`.`uid` AND `owner`.`cid` = `post-thread-user`.`owner-id`
|
LEFT JOIN `user-contact` AS `owner` ON `owner`.`uid` = `post-thread-user`.`uid` AND `owner`.`cid` = `post-thread-user`.`owner-id`
|
||||||
INNER JOIN `contact` AS `ownercontact` ON `ownercontact`.`id` = `post-thread-user`.`owner-id`
|
INNER JOIN `contact` AS `ownercontact` ON `ownercontact`.`id` = `post-thread-user`.`owner-id`
|
||||||
LEFT JOIN `post-user` AS `parent-post` ON `parent-post`.`uri-id` = `post-user`.`parent-uri-id` AND `parent-post`.`uid` = `post-user`.`uid`
|
|
||||||
WHERE `post-user`.`visible` AND NOT `post-user`.`deleted`
|
WHERE `post-user`.`visible` AND NOT `post-user`.`deleted`
|
||||||
AND (NOT `contact`.`readonly` AND NOT `contact`.`blocked` AND NOT `contact`.`pending`)
|
AND (NOT `contact`.`readonly` AND NOT `contact`.`blocked` AND NOT `contact`.`pending`)
|
||||||
AND (`post-user`.`hidden` IS NULL OR NOT `post-user`.`hidden`)
|
AND (`post-user`.`hidden` IS NULL OR NOT `post-user`.`hidden`)
|
||||||
|
@ -781,7 +777,7 @@
|
||||||
"network-thread-view" => [
|
"network-thread-view" => [
|
||||||
"fields" => [
|
"fields" => [
|
||||||
"uri-id" => ["post-thread-user", "uri-id"],
|
"uri-id" => ["post-thread-user", "uri-id"],
|
||||||
"parent" => ["parent-post", "id"],
|
"parent" => ["post-thread-user", "post-user-id"],
|
||||||
"received" => ["post-thread-user", "received"],
|
"received" => ["post-thread-user", "received"],
|
||||||
"commented" => ["post-thread-user", "commented"],
|
"commented" => ["post-thread-user", "commented"],
|
||||||
"created" => ["post-thread-user", "created"],
|
"created" => ["post-thread-user", "created"],
|
||||||
|
@ -798,7 +794,6 @@
|
||||||
LEFT JOIN `user-contact` AS `author` ON `author`.`uid` = `post-thread-user`.`uid` AND `author`.`cid` = `post-thread-user`.`author-id`
|
LEFT JOIN `user-contact` AS `author` ON `author`.`uid` = `post-thread-user`.`uid` AND `author`.`cid` = `post-thread-user`.`author-id`
|
||||||
LEFT JOIN `user-contact` AS `owner` ON `owner`.`uid` = `post-thread-user`.`uid` AND `owner`.`cid` = `post-thread-user`.`owner-id`
|
LEFT JOIN `user-contact` AS `owner` ON `owner`.`uid` = `post-thread-user`.`uid` AND `owner`.`cid` = `post-thread-user`.`owner-id`
|
||||||
LEFT JOIN `contact` AS `ownercontact` ON `ownercontact`.`id` = `post-thread-user`.`owner-id`
|
LEFT JOIN `contact` AS `ownercontact` ON `ownercontact`.`id` = `post-thread-user`.`owner-id`
|
||||||
LEFT JOIN `post-user` AS `parent-post` ON `parent-post`.`uri-id` = `post-user`.`parent-uri-id` AND `parent-post`.`uid` = `post-user`.`uid`
|
|
||||||
WHERE `post-user`.`visible` AND NOT `post-user`.`deleted`
|
WHERE `post-user`.`visible` AND NOT `post-user`.`deleted`
|
||||||
AND (NOT `contact`.`readonly` AND NOT `contact`.`blocked` AND NOT `contact`.`pending`)
|
AND (NOT `contact`.`readonly` AND NOT `contact`.`blocked` AND NOT `contact`.`pending`)
|
||||||
AND (`post-thread-user`.`hidden` IS NULL OR NOT `post-thread-user`.`hidden`)
|
AND (`post-thread-user`.`hidden` IS NULL OR NOT `post-thread-user`.`hidden`)
|
||||||
|
|
Loading…
Reference in New Issue
Block a user