refactor: DB optimizations

This commit is contained in:
Martin Ambrus
2017-10-23 17:50:33 +02:00
parent 40ad09865c
commit 5567bcd85d
3 changed files with 7 additions and 1 deletions
+2 -1
View File
@@ -1032,7 +1032,8 @@ CREATE TABLE IF NOT EXISTS `%PREFIX%medal` (
`points` varchar(15) NULL,
`img` varchar(10) NULL,
`del` tinyint(1) NULL DEFAULT '0',
PRIMARY KEY (`id`)
PRIMARY KEY (`id`),
KEY `week` (`week`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ;
--
+4
View File
@@ -1,3 +1,7 @@
-- 23.10.2017 -> SQL optimizations
ALTER TABLE `s1_medal` ADD INDEX(`week`);
-- 22.10.2017 -> SQL optimizations
ALTER TABLE `s1_users` ADD INDEX(`tribe`);
ALTER TABLE `s1_users` ADD INDEX `timestamp-tribe` (`timestamp`, `tribe`);
+1
View File
@@ -10,5 +10,6 @@
"SELECT * FROM s1_vdata WHERE wood > maxstore OR clay > maxstore OR iron > maxstore OR crop > maxcrop"
"SELECT * FROM s1_odata WHERE maxstore < 800 OR maxcrop < 800"
"SELECT * FROM s1_vdata WHERE wood < 0 OR clay < 0 OR iron < 0 OR crop < 0"
"SELECT * FROM `s1_fdata`"
- try to find and fix this (it's probably automation but has came up with a new registration, first login):
"UPDATE s1_units set hero = hero - WHERE vref = 38801"