some more DB tuning.

This commit is contained in:
Mario Vavti
2018-02-15 19:24:15 +01:00
parent 45b42cbc1c
commit 9e251a1abc
5 changed files with 29 additions and 11 deletions

View File

@@ -652,6 +652,8 @@ CREATE TABLE IF NOT EXISTS `item` (
KEY `uid_created` (`uid`, `created`),
KEY `uid_item_unseen` (`uid`, `item_unseen`),
KEY `uid_item_type` (`uid`, `item_type`),
KEY `uid_item_thread_top` (`uid`, `item_thread_top`),
KEY `uid_item_blocked` (`uid`, `item_blocked`),
KEY `aid` (`aid`),
KEY `owner_xchan` (`owner_xchan`),
KEY `author_xchan` (`author_xchan`),
@@ -680,7 +682,6 @@ CREATE TABLE IF NOT EXISTS `item` (
KEY `item_starred` (`item_starred`),
KEY `item_uplink` (`item_uplink`),
KEY `item_wall` (`item_wall`),
KEY `item_thread_top` (`item_thread_top`),
KEY `item_notshown` (`item_notshown`),
KEY `item_nsfw` (`item_nsfw`),
KEY `item_relay` (`item_relay`),
@@ -690,7 +691,8 @@ CREATE TABLE IF NOT EXISTS `item` (
KEY `item_verified` (`item_verified`),
KEY `item_retained` (`item_retained`),
KEY `item_rss` (`item_rss`),
KEY `item_consensus` (`item_consensus`)
KEY `item_consensus` (`item_consensus`),
KEY `item_deleted_pending_remove_changed` (`item_deleted`, `item_pending_remove`, `changed`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
CREATE TABLE IF NOT EXISTS `item_id` (

View File

@@ -1,6 +1,6 @@
<?php
define( 'UPDATE_VERSION' , 1201 );
define( 'UPDATE_VERSION' , 1202 );
/**
*
@@ -3113,3 +3113,19 @@ function update_r1200() {
return UPDATE_SUCCESS;
return UPDATE_FAILED;
}
function update_r1201() {
if(ACTIVE_DBTYPE == DBTYPE_MYSQL) {
$r = q("ALTER TABLE item
DROP INDEX item_thread_top,
ADD INDEX uid_item_thread_top (uid, item_thread_top),
ADD INDEX uid_item_blocked (uid, item_blocked),
ADD INDEX item_deleted_pending_remove_changed (item_deleted, item_pending_remove, changed)
");
}
if($r)
return UPDATE_SUCCESS;
return UPDATE_FAILED;
}