]> git.mxchange.org Git - friendica.git/commitdiff
Issue 13560: new indexes to improve circle loading time
authorMichael <heluecht@pirati.ca>
Sat, 16 Dec 2023 18:28:33 +0000 (18:28 +0000)
committerMichael <heluecht@pirati.ca>
Sat, 16 Dec 2023 18:28:33 +0000 (18:28 +0000)
database.sql
doc/database/db_post-thread-user.md
static/dbstructure.config.php

index 134d1f82619bb729f2abada5414666a6e025cfa0..81082cb38eae5efb1b5f6de222c69618551fd242 100644 (file)
@@ -1,6 +1,6 @@
 -- ------------------------------------------
 -- 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_wall_received` (`uid`,`wall`,`received`),
         INDEX `uid_commented` (`uid`,`commented`),
+        INDEX `uid_created` (`uid`,`created`),
         INDEX `uid_starred` (`uid`,`starred`),
         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 (`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,
index b4114d13c9d83fee986b5731cbe57638a1339422..a89d94c96fa09fa7346cc2a0836014b9072a9f7c 100644 (file)
@@ -36,27 +36,31 @@ Fields
 Indexes
 ------------
 
-| Name              | Fields              |
-| ----------------- | ------------------- |
-| PRIMARY           | uid, uri-id         |
-| uri-id            | uri-id              |
-| conversation-id   | conversation-id     |
-| owner-id          | owner-id            |
-| author-id         | author-id           |
-| causer-id         | causer-id           |
-| uid               | uid                 |
-| contact-id        | contact-id          |
-| psid              | psid                |
-| post-user-id      | post-user-id        |
-| commented         | commented           |
-| received          | received            |
-| author-id_created | author-id, created  |
-| owner-id_created  | owner-id, created   |
-| uid_received      | uid, received       |
-| uid_wall_received | uid, wall, received |
-| uid_commented     | uid, commented      |
-| uid_starred       | uid, starred        |
-| uid_mention       | uid, mention        |
+| Name                 | Fields                |
+| -------------------- | --------------------- |
+| PRIMARY              | uid, uri-id           |
+| uri-id               | uri-id                |
+| conversation-id      | conversation-id       |
+| owner-id             | owner-id              |
+| author-id            | author-id             |
+| causer-id            | causer-id             |
+| uid                  | uid                   |
+| contact-id           | contact-id            |
+| psid                 | psid                  |
+| post-user-id         | post-user-id          |
+| commented            | commented             |
+| received             | received              |
+| author-id_created    | author-id, created    |
+| owner-id_created     | owner-id, created     |
+| uid_received         | uid, received         |
+| uid_wall_received    | uid, wall, received   |
+| uid_commented        | uid, commented        |
+| uid_created          | uid, created          |
+| uid_starred          | uid, starred          |
+| uid_mention          | uid, mention          |
+| contact-id_commented | contact-id, commented |
+| contact-id_received  | contact-id, received  |
+| contact-id_created   | contact-id, created   |
 
 Foreign Keys
 ------------
index 53221d9e444cdfd92c60ba8f8b24fae610b027f2..64c9bdff1f7cec3afda6e0dc3a8a7a7ffa6ed7d4 100644 (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', 1541);
+       define('DB_UPDATE_VERSION', 1542);
 }
 
 return [
@@ -1607,8 +1607,13 @@ return [
                        "uid_received" => ["uid", "received"],
                        "uid_wall_received" => ["uid", "wall", "received"],
                        "uid_commented" => ["uid", "commented"],
+                       "uid_received" => ["uid", "received"],
+                       "uid_created" => ["uid", "created"],
                        "uid_starred" => ["uid", "starred"],
                        "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" => [