1
0
mirror of https://github.com/vichan-devel/vichan.git synced 2024-11-27 17:00:52 +01:00

New index in post tables for listing threads slightly faster (index pages)

This commit is contained in:
Michael Foster 2013-09-01 22:15:03 +10:00
parent cf3173d226
commit 22fcca343f
2 changed files with 8 additions and 2 deletions

View File

@ -1,7 +1,7 @@
<?php <?php
// Installation/upgrade file // Installation/upgrade file
define('VERSION', 'v0.9.6-dev-15'); define('VERSION', 'v0.9.6-dev-16');
require 'inc/functions.php'; require 'inc/functions.php';
@ -381,6 +381,11 @@ if (file_exists($config['has_installed'])) {
query("ALTER TABLE ``bans`` ADD INDEX `ip` (`ip`)") or error(db_error()); query("ALTER TABLE ``bans`` ADD INDEX `ip` (`ip`)") or error(db_error());
query("ALTER TABLE ``noticeboard`` ADD INDEX `time` (`time`)") or error(db_error()); query("ALTER TABLE ``noticeboard`` ADD INDEX `time` (`time`)") or error(db_error());
query("ALTER TABLE ``pms`` ADD INDEX `to` (`to`, `unread`)") or error(db_error()); query("ALTER TABLE ``pms`` ADD INDEX `to` (`to`, `unread`)") or error(db_error());
case 'v0.9.6-dev-15':
foreach ($boards as &$board) {
query(sprintf("ALTER TABLE ``posts_%s``
ADD INDEX `list_threads` (`thread`, `sticky`, `bump`)", $board['uri'])) or error(db_error());
}
case false: case false:
// Update version number // Update version number
file_write($config['has_installed'], VERSION); file_write($config['has_installed'], VERSION);

View File

@ -29,6 +29,7 @@ CREATE TABLE IF NOT EXISTS ``posts_{{ board }}`` (
KEY `thread_id` (`thread`,`id`), KEY `thread_id` (`thread`,`id`),
KEY `filehash` (`filehash`(40)), KEY `filehash` (`filehash`(40)),
KEY `time` (`time`), KEY `time` (`time`),
KEY `ip` (`ip`) KEY `ip` (`ip`),
KEY `list_threads` (`thread`, `sticky`, `bump`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8mb4 AUTO_INCREMENT=1 ; ) ENGINE=MyISAM DEFAULT CHARSET=utf8mb4 AUTO_INCREMENT=1 ;