mirror of
https://github.com/friendica/friendica
synced 2024-12-22 18:40:17 +00:00
Added index, join order fixed
This commit is contained in:
parent
bb59ca4de8
commit
d78cf95495
3 changed files with 20 additions and 18 deletions
13
database.sql
13
database.sql
|
@ -985,6 +985,7 @@ CREATE TABLE IF NOT EXISTS `post-content` (
|
|||
`plink` varchar(255) NOT NULL DEFAULT '' COMMENT 'permalink or URL to a displayable copy of the message at its source',
|
||||
PRIMARY KEY(`uri-id`),
|
||||
INDEX `plink` (`plink`(191)),
|
||||
INDEX `resource-id` (`resource-id`),
|
||||
FULLTEXT INDEX `title-content-warning-body` (`title`,`content-warning`,`body`),
|
||||
FOREIGN KEY (`uri-id`) REFERENCES `item-uri` (`id`) ON UPDATE RESTRICT ON DELETE CASCADE
|
||||
) DEFAULT COLLATE utf8mb4_general_ci COMMENT='Content for all posts';
|
||||
|
@ -1592,9 +1593,9 @@ CREATE VIEW `post-view` AS SELECT
|
|||
`parent-post-author`.`network` AS `parent-author-network`
|
||||
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`
|
||||
LEFT JOIN `contact` ON `contact`.`id` = `post-user`.`contact-id`
|
||||
LEFT JOIN `contact` AS `author` ON `author`.`id` = `post-user`.`author-id`
|
||||
LEFT JOIN `contact` AS `owner` ON `owner`.`id` = `post-user`.`owner-id`
|
||||
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`
|
||||
LEFT JOIN `item-uri` ON `item-uri`.`id` = `post-user`.`uri-id`
|
||||
LEFT JOIN `item-uri` AS `thr-parent-item-uri` ON `thr-parent-item-uri`.`id` = `post-user`.`thr-parent-id`
|
||||
|
@ -1750,9 +1751,9 @@ CREATE VIEW `post-thread-view` AS SELECT
|
|||
`parent-post-author`.`network` AS `parent-author-network`
|
||||
FROM `post-thread-user`
|
||||
INNER JOIN `post-user` ON `post-user`.`id` = `post-thread-user`.`post-user-id`
|
||||
LEFT JOIN `contact` ON `contact`.`id` = `post-thread-user`.`contact-id`
|
||||
LEFT JOIN `contact` AS `author` ON `author`.`id` = `post-thread-user`.`author-id`
|
||||
LEFT JOIN `contact` AS `owner` ON `owner`.`id` = `post-thread-user`.`owner-id`
|
||||
STRAIGHT_JOIN `contact` ON `contact`.`id` = `post-thread-user`.`contact-id`
|
||||
STRAIGHT_JOIN `contact` AS `author` ON `author`.`id` = `post-thread-user`.`author-id`
|
||||
STRAIGHT_JOIN `contact` AS `owner` ON `owner`.`id` = `post-thread-user`.`owner-id`
|
||||
LEFT JOIN `contact` AS `causer` ON `causer`.`id` = `post-thread-user`.`causer-id`
|
||||
LEFT JOIN `item-uri` ON `item-uri`.`id` = `post-thread-user`.`uri-id`
|
||||
LEFT JOIN `item-uri` AS `thr-parent-item-uri` ON `thr-parent-item-uri`.`id` = `post-user`.`thr-parent-id`
|
||||
|
|
|
@ -1042,6 +1042,7 @@ return [
|
|||
"indexes" => [
|
||||
"PRIMARY" => ["uri-id"],
|
||||
"plink" => ["plink(191)"],
|
||||
"resource-id" => ["resource-id"],
|
||||
"title-content-warning-body" => ["FULLTEXT", "title", "content-warning", "body"],
|
||||
]
|
||||
],
|
||||
|
|
|
@ -139,7 +139,7 @@
|
|||
"causer-link" => ["causer", "url"],
|
||||
"causer-addr" => ["causer", "addr"],
|
||||
"causer-name" => ["causer", "name"],
|
||||
"causer-nick" => ["causer", "nick"],
|
||||
"causer-nick" => ["causer", "nick"],
|
||||
"causer-avatar" => ["causer", "thumb"],
|
||||
"causer-network" => ["causer", "network"],
|
||||
"causer-blocked" => ["causer", "blocked"],
|
||||
|
@ -170,15 +170,15 @@
|
|||
"parent-guid" => ["parent-item-uri", "guid"],
|
||||
"parent-network" => ["parent-post", "network"],
|
||||
"parent-author-id" => ["parent-post", "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-network" => ["parent-post-author", "network"],
|
||||
"parent-author-network" => ["parent-post-author", "network"],
|
||||
],
|
||||
"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`
|
||||
LEFT JOIN `contact` ON `contact`.`id` = `post-user`.`contact-id`
|
||||
LEFT JOIN `contact` AS `author` ON `author`.`id` = `post-user`.`author-id`
|
||||
LEFT JOIN `contact` AS `owner` ON `owner`.`id` = `post-user`.`owner-id`
|
||||
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`
|
||||
LEFT JOIN `item-uri` ON `item-uri`.`id` = `post-user`.`uri-id`
|
||||
LEFT JOIN `item-uri` AS `thr-parent-item-uri` ON `thr-parent-item-uri`.`id` = `post-user`.`thr-parent-id`
|
||||
|
@ -295,7 +295,7 @@
|
|||
"causer-link" => ["causer", "url"],
|
||||
"causer-addr" => ["causer", "addr"],
|
||||
"causer-name" => ["causer", "name"],
|
||||
"causer-nick" => ["causer", "nick"],
|
||||
"causer-nick" => ["causer", "nick"],
|
||||
"causer-avatar" => ["causer", "thumb"],
|
||||
"causer-network" => ["causer", "network"],
|
||||
"causer-blocked" => ["causer", "blocked"],
|
||||
|
@ -326,15 +326,15 @@
|
|||
"parent-guid" => ["parent-item-uri", "guid"],
|
||||
"parent-network" => ["parent-post", "network"],
|
||||
"parent-author-id" => ["parent-post", "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-network" => ["parent-post-author", "network"],
|
||||
"parent-author-network" => ["parent-post-author", "network"],
|
||||
],
|
||||
"query" => "FROM `post-thread-user`
|
||||
INNER JOIN `post-user` ON `post-user`.`id` = `post-thread-user`.`post-user-id`
|
||||
LEFT JOIN `contact` ON `contact`.`id` = `post-thread-user`.`contact-id`
|
||||
LEFT JOIN `contact` AS `author` ON `author`.`id` = `post-thread-user`.`author-id`
|
||||
LEFT JOIN `contact` AS `owner` ON `owner`.`id` = `post-thread-user`.`owner-id`
|
||||
STRAIGHT_JOIN `contact` ON `contact`.`id` = `post-thread-user`.`contact-id`
|
||||
STRAIGHT_JOIN `contact` AS `author` ON `author`.`id` = `post-thread-user`.`author-id`
|
||||
STRAIGHT_JOIN `contact` AS `owner` ON `owner`.`id` = `post-thread-user`.`owner-id`
|
||||
LEFT JOIN `contact` AS `causer` ON `causer`.`id` = `post-thread-user`.`causer-id`
|
||||
LEFT JOIN `item-uri` ON `item-uri`.`id` = `post-thread-user`.`uri-id`
|
||||
LEFT JOIN `item-uri` AS `thr-parent-item-uri` ON `thr-parent-item-uri`.`id` = `post-user`.`thr-parent-id`
|
||||
|
|
Loading…
Reference in a new issue