From cbf4544887c7f496f2b2312727fe7bcb64a6d6c8 Mon Sep 17 00:00:00 2001 From: Alexander Kampmann Date: Thu, 5 Apr 2012 13:27:09 +0200 Subject: added index to config and pconfig table changed config.php to use REPLACE instead of INSERT, this removes one db hit. --- database.sql | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) mode change 100755 => 100644 database.sql (limited to 'database.sql') diff --git a/database.sql b/database.sql old mode 100755 new mode 100644 index 327b482c0..a039746e8 --- a/database.sql +++ b/database.sql @@ -34,10 +34,11 @@ CREATE TABLE IF NOT EXISTS `challenge` ( CREATE TABLE IF NOT EXISTS `config` ( `id` int(10) unsigned NOT NULL AUTO_INCREMENT, - `cat` char(255) NOT NULL, - `k` char(255) NOT NULL, + `cat` char(255) CHARACTER SET ascii COLLATE ascii_general_ci NOT NULL, + `k` char(255) CHARACTER SET ascii COLLATE ascii_general_ci NOT NULL, `v` text NOT NULL, - PRIMARY KEY (`id`) + PRIMARY KEY (`id`), + UNIQUE KEY `access`(`cat`,`k`) ) ENGINE=MyISAM DEFAULT CHARSET=utf8; @@ -536,9 +537,10 @@ INDEX ( `batch` ) CREATE TABLE IF NOT EXISTS `pconfig` ( `id` INT NOT NULL AUTO_INCREMENT PRIMARY KEY , `uid` INT NOT NULL DEFAULT '0', -`cat` CHAR( 255 ) NOT NULL , -`k` CHAR( 255 ) NOT NULL , -`v` MEDIUMTEXT NOT NULL +`cat` CHAR( 255 ) CHARACTER SET ascii COLLATE ascii_general_ci NOT NULL , +`k` CHAR( 255 ) CHARACTER SET ascii COLLATE ascii_general_ci NOT NULL , +`v` MEDIUMTEXT NOT NULL, +UNIQUE KEY `access`(`cat`, `k`) ) ENGINE = MyISAM DEFAULT CHARSET=utf8; -- cgit v1.2.3