1
1
Fork 0

Some small performance tweaks (indexes)

This commit is contained in:
Michael Vogel 2020-08-18 12:50:18 +02:00
parent a8431584ba
commit b5cca1ab93
4 changed files with 18 additions and 13 deletions

View file

@ -1,6 +1,6 @@
-- ------------------------------------------
-- Friendica 2020.09-dev (Red Hot Poker)
-- DB_UPDATE_VERSION 1360
-- DB_UPDATE_VERSION 1361
-- ------------------------------------------
@ -132,18 +132,19 @@ CREATE TABLE IF NOT EXISTS `contact` (
PRIMARY KEY(`id`),
INDEX `uid_name` (`uid`,`name`(190)),
INDEX `self_uid` (`self`,`uid`),
INDEX `alias_uid` (`alias`(32),`uid`),
INDEX `alias_uid` (`alias`(96),`uid`),
INDEX `pending_uid` (`pending`,`uid`),
INDEX `blocked_uid` (`blocked`,`uid`),
INDEX `uid_rel_network_poll` (`uid`,`rel`,`network`,`poll`(64),`archive`),
INDEX `uid_network_batch` (`uid`,`network`,`batch`(64)),
INDEX `addr_uid` (`addr`(32),`uid`),
INDEX `nurl_uid` (`nurl`(32),`uid`),
INDEX `addr_uid` (`addr`(96),`uid`),
INDEX `nurl_uid` (`nurl`(96),`uid`),
INDEX `nick_uid` (`nick`(32),`uid`),
INDEX `attag_uid` (`attag`(32),`uid`),
INDEX `attag_uid` (`attag`(96),`uid`),
INDEX `dfrn-id` (`dfrn-id`(64)),
INDEX `issued-id` (`issued-id`(64)),
INDEX `network_uid_lastupdate` (`network`,`uid`,`last-update`),
INDEX `uid_network_self_lastupdate` (`uid`,`network`,`self`,`last-update`),
INDEX `uid_lastitem` (`uid`,`last-item`),
INDEX `gsid` (`gsid`),
FOREIGN KEY (`gsid`) REFERENCES `gserver` (`id`) ON UPDATE RESTRICT ON DELETE RESTRICT
@ -644,6 +645,7 @@ CREATE TABLE IF NOT EXISTS `item` (
INDEX `resource-id` (`resource-id`),
INDEX `deleted_changed` (`deleted`,`changed`),
INDEX `uid_wall_changed` (`uid`,`wall`,`changed`),
INDEX `uid_unseen_wall` (`uid`,`unseen`,`wall`),
INDEX `mention_uid_id` (`mention`,`uid`,`id`),
INDEX `uid_eventid` (`uid`,`event-id`),
INDEX `icid` (`icid`),
@ -1350,6 +1352,7 @@ CREATE TABLE IF NOT EXISTS `workerqueue` (
INDEX `done_priority_created` (`done`,`priority`,`created`),
INDEX `done_priority_next_try` (`done`,`priority`,`next_try`),
INDEX `done_pid_next_try` (`done`,`pid`,`next_try`),
INDEX `done_pid_retrial` (`done`,`pid`,`retrial`),
INDEX `done_pid_priority_created` (`done`,`pid`,`priority`,`created`)
) DEFAULT COLLATE utf8mb4_general_ci COMMENT='Background tasks queue entries';
@ -1513,7 +1516,6 @@ CREATE VIEW `owner-view` AS SELECT
`contact`.`archive` AS `archive`,
`contact`.`pending` AS `pending`,
`contact`.`deleted` AS `deleted`,
`contact`.`rating` AS `rating`,
`contact`.`unsearchable` AS `unsearchable`,
`contact`.`sensitive` AS `sensitive`,
`contact`.`baseurl` AS `baseurl`,

View file

@ -733,7 +733,7 @@ class Worker
}
}
Logger::log("Load: " . $load ."/" . $maxsysload . " - processes: " . $deferred . "/" . $active . "/" . $waiting_processes . $processlist . " - maximum: " . $queues . "/" . $maxqueues, Logger::DEBUG);
Logger::notice("Load: " . $load ."/" . $maxsysload . " - processes: " . $deferred . "/" . $active . "/" . $waiting_processes . $processlist . " - maximum: " . $queues . "/" . $maxqueues);
// Are there fewer workers running as possible? Then fork a new one.
if (!DI::config()->get("system", "worker_dont_fork", false) && ($queues > ($active + 1)) && self::entriesExists()) {

View file

@ -91,6 +91,7 @@ class ClearCache
DBA::e("OPTIMIZE TABLE `profile_check`");
DBA::e("OPTIMIZE TABLE `session`");
DBA::e("OPTIMIZE TABLE `tokens`");
DBA::e("OPTIMIZE TABLE `process`");
Logger::info('Optimize finished');
}

View file

@ -54,7 +54,7 @@
use Friendica\Database\DBA;
if (!defined('DB_UPDATE_VERSION')) {
define('DB_UPDATE_VERSION', 1360);
define('DB_UPDATE_VERSION', 1361);
}
return [
@ -190,18 +190,19 @@ return [
"PRIMARY" => ["id"],
"uid_name" => ["uid", "name(190)"],
"self_uid" => ["self", "uid"],
"alias_uid" => ["alias(32)", "uid"],
"alias_uid" => ["alias(96)", "uid"],
"pending_uid" => ["pending", "uid"],
"blocked_uid" => ["blocked", "uid"],
"uid_rel_network_poll" => ["uid", "rel", "network", "poll(64)", "archive"],
"uid_network_batch" => ["uid", "network", "batch(64)"],
"addr_uid" => ["addr(32)", "uid"],
"nurl_uid" => ["nurl(32)", "uid"],
"addr_uid" => ["addr(96)", "uid"],
"nurl_uid" => ["nurl(96)", "uid"],
"nick_uid" => ["nick(32)", "uid"],
"attag_uid" => ["attag(32)", "uid"],
"attag_uid" => ["attag(96)", "uid"],
"dfrn-id" => ["dfrn-id(64)"],
"issued-id" => ["issued-id(64)"],
"network_uid_lastupdate" => ["network", "uid", "last-update"],
"uid_network_self_lastupdate" => ["uid", "network", "self", "last-update"],
"uid_lastitem" => ["uid", "last-item"],
"gsid" => ["gsid"]
]
@ -1462,6 +1463,7 @@ return [
"done_priority_created" => ["done", "priority", "created"],
"done_priority_next_try" => ["done", "priority", "next_try"],
"done_pid_next_try" => ["done", "pid", "next_try"],
"done_pid_retrial" => ["done", "pid", "retrial"],
"done_pid_priority_created" => ["done", "pid", "priority", "created"]
]
],