From b1c1a25c26ceac45793536c9a4fe903075cc3b63 Mon Sep 17 00:00:00 2001 From: Macil Tech Date: Mon, 29 Oct 2012 22:10:58 -0600 Subject: [PATCH 1/2] Add (`thread`, `id`) multi-column key to optimize rebuilding index pages. This SQL command can be used to add the key to existing board tables: create index `thread_id` on posts_%s (`thread`, `id`); --- templates/posts.sql | 1 + 1 file changed, 1 insertion(+) diff --git a/templates/posts.sql b/templates/posts.sql index d10749f8..ac383ab0 100644 --- a/templates/posts.sql +++ b/templates/posts.sql @@ -27,6 +27,7 @@ CREATE TABLE IF NOT EXISTS `posts_{{ board }}` ( `embed` text, UNIQUE KEY `id` (`id`), KEY `thread` (`thread`), + KEY `thread_id` (`thread`, `id`), KEY `time` (`time`), FULLTEXT KEY `body` (`body`) ) ENGINE=MyISAM DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ; From f01813d95b2e39fc938262a3aca6986d97c7da6b Mon Sep 17 00:00:00 2001 From: Macil Tech Date: Sat, 19 Jan 2013 01:20:55 -0600 Subject: [PATCH 2/2] Remove now redundant single-column `thread` key from posts_* tables. --- templates/posts.sql | 1 - 1 file changed, 1 deletion(-) diff --git a/templates/posts.sql b/templates/posts.sql index ac383ab0..c766d38e 100644 --- a/templates/posts.sql +++ b/templates/posts.sql @@ -26,7 +26,6 @@ CREATE TABLE IF NOT EXISTS `posts_{{ board }}` ( `sage` int(1) NOT NULL, `embed` text, UNIQUE KEY `id` (`id`), - KEY `thread` (`thread`), KEY `thread_id` (`thread`, `id`), KEY `time` (`time`), FULLTEXT KEY `body` (`body`)