From 8fb63dc91c87d20a5b56c9c57b09e29779f8cd71 Mon Sep 17 00:00:00 2001 From: megamage Date: Sun, 9 Aug 2009 15:35:46 -0500 Subject: [8332] Add non-unique key `accid` for `realmcharacters` table for speedup queries by this field. Author: rilex Just note about related _not_ mangos bug: this table _expected_ to have primary key by pair (`realmid`,`acctid`). If used DB not have it for table, then this wrongly setup of DB. --HG-- branch : trunk --- sql/realmd.sql | 23 +++++++++++++++++++++- .../4859_8332_01_realmd_realmcharacters.sql | 4 ++++ 2 files changed, 26 insertions(+), 1 deletion(-) create mode 100644 sql/updates/4859_8332_01_realmd_realmcharacters.sql diff --git a/sql/realmd.sql b/sql/realmd.sql index a57e244d760..effad3d3e32 100644 --- a/sql/realmd.sql +++ b/sql/realmd.sql @@ -15,6 +15,26 @@ /*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */; /*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */; +-- +-- Table structure for table `realmd_db_version` +-- + +DROP TABLE IF EXISTS `realmd_db_version`; +CREATE TABLE `realmd_db_version` ( + `required_8332_01_realmd_realmcharacters` bit(1) default NULL +) ENGINE=MyISAM DEFAULT CHARSET=utf8 ROW_FORMAT=FIXED COMMENT='Last applied sql update to DB'; + +-- +-- Dumping data for table `realmd_db_version` +-- + +LOCK TABLES `realmd_db_version` WRITE; +/*!40000 ALTER TABLE `realmd_db_version` DISABLE KEYS */; +INSERT INTO `realmd_db_version` VALUES +(NULL); +/*!40000 ALTER TABLE `realmd_db_version` ENABLE KEYS */; +UNLOCK TABLES; + -- -- Table structure for table `account` -- @@ -134,7 +154,8 @@ CREATE TABLE `realmcharacters` ( `realmid` int(11) unsigned NOT NULL default '0', `acctid` bigint(20) unsigned NOT NULL, `numchars` tinyint(3) unsigned NOT NULL default '0', - PRIMARY KEY (`realmid`,`acctid`) + PRIMARY KEY (`realmid`,`acctid`), + KEY (acctid) ) ENGINE=MyISAM DEFAULT CHARSET=utf8 ROW_FORMAT=DYNAMIC COMMENT='Realm Character Tracker'; -- diff --git a/sql/updates/4859_8332_01_realmd_realmcharacters.sql b/sql/updates/4859_8332_01_realmd_realmcharacters.sql new file mode 100644 index 00000000000..c7adb23d890 --- /dev/null +++ b/sql/updates/4859_8332_01_realmd_realmcharacters.sql @@ -0,0 +1,4 @@ +-- ALTER TABLE realmd_db_version CHANGE COLUMN required_7938_01_realmd_account required_8332_01_realmd_realmcharacters bit; + +ALTER TABLE realmcharacters + ADD KEY (acctid); -- cgit v1.2.3