Improved indexes, avoiding SQL errors, improving speed

This commit is contained in:
Michael 2021-02-20 20:07:25 +00:00
commit 92a8a399de
8 changed files with 43 additions and 75 deletions

View file

@ -55,7 +55,7 @@
use Friendica\Database\DBA;
if (!defined('DB_UPDATE_VERSION')) {
define('DB_UPDATE_VERSION', 1404);
define('DB_UPDATE_VERSION', 1405);
}
return [
@ -1002,7 +1002,6 @@ return [
"author-id" => ["author-id"],
"causer-id" => ["causer-id"],
"vid" => ["vid"],
"received" => ["received"],
]
],
"post-category" => [
@ -1110,7 +1109,6 @@ return [
"network" => ["type" => "char(4)", "not null" => "1", "default" => "", "comment" => ""],
"created" => ["type" => "datetime", "not null" => "1", "default" => DBA::NULL_DATETIME, "comment" => ""],
"received" => ["type" => "datetime", "not null" => "1", "default" => DBA::NULL_DATETIME, "comment" => ""],
"changed" => ["type" => "datetime", "not null" => "1", "default" => DBA::NULL_DATETIME, "comment" => "Date that something in the conversation changed, indicating clients should fetch the conversation again"],
"commented" => ["type" => "datetime", "not null" => "1", "default" => DBA::NULL_DATETIME, "comment" => ""]
],
"indexes" => [
@ -1160,26 +1158,24 @@ return [
"PRIMARY" => ["id"],
"uid_uri-id" => ["UNIQUE", "uid", "uri-id"],
"uri-id" => ["uri-id"],
"contact-id" => ["contact-id"],
"psid" => ["psid"],
"uid_hidden" => ["uid", "hidden"],
"event-id" => ["event-id"],
"uid_wall" => ["uid", "wall"],
"parent-uri-id_uid" => ["parent-uri-id", "uid"],
"parent-uri-id" => ["parent-uri-id"],
"thr-parent-id" => ["thr-parent-id"],
"external-id" => ["external-id"],
"owner-id" => ["owner-id"],
"author-id_uid" => ["author-id", "uid"],
"author-id" => ["author-id"],
"causer-id" => ["causer-id"],
"vid" => ["vid"],
"uid_received" => ["uid", "received"],
"contact-id" => ["contact-id"],
"event-id" => ["event-id"],
"psid" => ["psid"],
"author-id_uid" => ["author-id", "uid"],
"author-id_received" => ["author-id", "received"],
"parent-uri-id_uid" => ["parent-uri-id", "uid"],
"uid_hidden" => ["uid", "hidden"],
"uid_contactid" => ["uid", "contact-id"],
"uid_unseen_contactid" => ["uid", "unseen", "contact-id"],
"uid_network_received" => ["uid", "network", "received"],
"uid_contactid_received" => ["uid", "contact-id", "received"],
"authorid_received" => ["author-id", "received"],
"uid_unseen" => ["uid", "unseen"],
"uid_unseen_wall" => ["uid", "unseen", "wall"],
"uid_eventid" => ["uid", "event-id"],
"psid_wall" => ["psid", "wall"],
],
],
"post-thread-user" => [
@ -1211,30 +1207,21 @@ return [
],
"indexes" => [
"PRIMARY" => ["uid", "uri-id"],
"uid_wall" => ["uid", "wall"],
"uid_pinned" => ["uid", "pinned"],
"uri-id" => ["uri-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"],
"owner-id" => ["owner-id"],
"causer-id" => ["causer-id"],
"uid_received" => ["uid", "received"],
"uid_commented" => ["uid", "commented"],
"uid_changed" => ["uid", "changed"],
"uid_contact-id" => ["uid", "contact-id", "received"],
"uid_unseen_contactid" => ["uid", "unseen", "contact-id"],
"uid_network_received" => ["uid", "network", "received"],
"uid_network_commented" => ["uid", "network", "commented"],
"uid_contact-id_received" => ["uid", "contact-id", "received"],
"author-id_received" => ["author-id", "received"],
"uid_wall_changed" => ["uid", "wall", "changed"],
"uid_unseen_wall" => ["uid", "unseen", "wall"],
"mention_uid" => ["mention", "uid"],
"psid_wall" => ["psid", "wall"],
"received" => ["received"],
"commented" => ["commented"],
"changed" => ["changed"],
"received" => ["received"],
"author-id_received" => ["author-id", "received"],
"uid_pinned" => ["uid", "pinned"],
"uid_commented" => ["uid", "commented"],
"mention_uid" => ["mention", "uid"],
"uid_mention" => ["uid", "mention"],
]
],
"post-user-notification" => [

View file

@ -134,6 +134,7 @@
"owner-network" => ["owner", "network"],
"owner-blocked" => ["owner", "blocked"],
"owner-hidden" => ["owner", "hidden"],
"owner-contact-type" => ["owner", "contact-type"],
"causer-id" => ["post-user", "causer-id"],
"causer-link" => ["causer", "url"],
"causer-addr" => ["causer", "addr"],
@ -289,6 +290,7 @@
"owner-network" => ["owner", "network"],
"owner-blocked" => ["owner", "blocked"],
"owner-hidden" => ["owner", "hidden"],
"owner-contact-type" => ["owner", "contact-type"],
"causer-id" => ["post-thread-user", "causer-id"],
"causer-link" => ["causer", "url"],
"causer-addr" => ["causer", "addr"],