Merge pull request #13728 from annando/issue-13560

Issue 13560: new indexes to improve circle loading time
pull/13742/head
Hypolite Petovan 2023-12-17 21:03:14 -05:00 committed by GitHub
commit cbe6e1dbb3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 36 additions and 23 deletions

View File

@ -1,6 +1,6 @@
-- ------------------------------------------ -- ------------------------------------------
-- Friendica 2023.09-rc (Giant Rhubarb) -- Friendica 2023.09-rc (Giant Rhubarb)
-- DB_UPDATE_VERSION 1541 -- DB_UPDATE_VERSION 1542
-- ------------------------------------------ -- ------------------------------------------
@ -1601,8 +1601,12 @@ CREATE TABLE IF NOT EXISTS `post-thread-user` (
INDEX `uid_received` (`uid`,`received`), INDEX `uid_received` (`uid`,`received`),
INDEX `uid_wall_received` (`uid`,`wall`,`received`), INDEX `uid_wall_received` (`uid`,`wall`,`received`),
INDEX `uid_commented` (`uid`,`commented`), INDEX `uid_commented` (`uid`,`commented`),
INDEX `uid_created` (`uid`,`created`),
INDEX `uid_starred` (`uid`,`starred`), INDEX `uid_starred` (`uid`,`starred`),
INDEX `uid_mention` (`uid`,`mention`), INDEX `uid_mention` (`uid`,`mention`),
INDEX `contact-id_commented` (`contact-id`,`commented`),
INDEX `contact-id_received` (`contact-id`,`received`),
INDEX `contact-id_created` (`contact-id`,`created`),
FOREIGN KEY (`uri-id`) REFERENCES `item-uri` (`id`) ON UPDATE RESTRICT ON DELETE CASCADE, FOREIGN KEY (`uri-id`) REFERENCES `item-uri` (`id`) ON UPDATE RESTRICT ON DELETE CASCADE,
FOREIGN KEY (`conversation-id`) REFERENCES `item-uri` (`id`) ON UPDATE RESTRICT ON DELETE CASCADE, FOREIGN KEY (`conversation-id`) REFERENCES `item-uri` (`id`) ON UPDATE RESTRICT ON DELETE CASCADE,
FOREIGN KEY (`owner-id`) REFERENCES `contact` (`id`) ON UPDATE RESTRICT ON DELETE RESTRICT, FOREIGN KEY (`owner-id`) REFERENCES `contact` (`id`) ON UPDATE RESTRICT ON DELETE RESTRICT,

View File

@ -37,7 +37,7 @@ Indexes
------------ ------------
| Name | Fields | | Name | Fields |
| ----------------- | ------------------- | | -------------------- | --------------------- |
| PRIMARY | uid, uri-id | | PRIMARY | uid, uri-id |
| uri-id | uri-id | | uri-id | uri-id |
| conversation-id | conversation-id | | conversation-id | conversation-id |
@ -55,8 +55,12 @@ Indexes
| uid_received | uid, received | | uid_received | uid, received |
| uid_wall_received | uid, wall, received | | uid_wall_received | uid, wall, received |
| uid_commented | uid, commented | | uid_commented | uid, commented |
| uid_created | uid, created |
| uid_starred | uid, starred | | uid_starred | uid, starred |
| uid_mention | uid, mention | | uid_mention | uid, mention |
| contact-id_commented | contact-id, commented |
| contact-id_received | contact-id, received |
| contact-id_created | contact-id, created |
Foreign Keys Foreign Keys
------------ ------------

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 // This file is required several times during the test in DbaDefinition which justifies this condition
if (!defined('DB_UPDATE_VERSION')) { if (!defined('DB_UPDATE_VERSION')) {
define('DB_UPDATE_VERSION', 1541); define('DB_UPDATE_VERSION', 1542);
} }
return [ return [
@ -1607,8 +1607,13 @@ return [
"uid_received" => ["uid", "received"], "uid_received" => ["uid", "received"],
"uid_wall_received" => ["uid", "wall", "received"], "uid_wall_received" => ["uid", "wall", "received"],
"uid_commented" => ["uid", "commented"], "uid_commented" => ["uid", "commented"],
"uid_received" => ["uid", "received"],
"uid_created" => ["uid", "created"],
"uid_starred" => ["uid", "starred"], "uid_starred" => ["uid", "starred"],
"uid_mention" => ["uid", "mention"], "uid_mention" => ["uid", "mention"],
"contact-id_commented" => ["contact-id", "commented"],
"contact-id_received" => ["contact-id", "received"],
"contact-id_created" => ["contact-id", "created"],
] ]
], ],
"post-user-notification" => [ "post-user-notification" => [