Created character_lookup table for applications that mirrors all character_ table fields minus blob fields for application lookups

- A 2.4GB character_ table will take 7 seconds to query on a SSD versus .1s on the character_lookup table
	- This also causes applications like Magelo to burst reads of the entire character table because of the blob fields that come with the reads, as much as 500-600MB/s even if a indexed id filter is provided
	- This field is synchronized on player save and has 0.001s DB hit
	- When we split out from the blob, ideally this table can be removed, but it really does no harm in mirroring data when a 2.6GB character table mirrors everything subtracting blob data down to 8MB
	- Required SQL: utils\sql\git\required\2014_08_24_character_lookup.sql
This commit is contained in:
akkadius 2014-08-24 08:52:14 -05:00
parent 3b048ee8a2
commit 633583c266
5 changed files with 51 additions and 0 deletions

View File

@ -2,6 +2,12 @@ EQEMu Changelog (Started on Sept 24, 2003 15:50)
-------------------------------------------------------
== 08/24/2014 ==
Akkadius: Character creation process crash fix and query cleanup
Akkadius: Created `character_lookup` table for applications that mirrors all `character_` table fields minus blob fields for application lookups
- A 2.4GB character_ table will take 7 seconds to query on a SSD versus .1s on the character_lookup table
- This also causes applications like Magelo to burst reads of the entire character table because of the blob fields that come with the reads, as much as 500-600MB/s even if a indexed id filter is provided
- This field is synchronized on player save and has 0.001s DB hit
- When we split out from the blob, ideally this table can be removed
- Required SQL: utils\sql\git\required\2014_08_24_character_lookup.sql
== 08/23/2014 ==
Akkadius: Changed zone process window title format, example: 'crushbone :: clients: 6 inst_id: 1 inst_ver: 0 :: port: 7015'

View File

@ -0,0 +1,33 @@
-- chracter_lookup table structure --
CREATE TABLE `character_lookup` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`account_id` int(11) NOT NULL DEFAULT '0',
`name` varchar(64) NOT NULL DEFAULT '',
`timelaston` int(11) unsigned DEFAULT '0',
`x` float NOT NULL DEFAULT '0',
`y` float NOT NULL DEFAULT '0',
`z` float NOT NULL DEFAULT '0',
`zonename` varchar(30) NOT NULL DEFAULT '',
`zoneid` smallint(6) NOT NULL DEFAULT '0',
`instanceid` smallint(5) unsigned NOT NULL DEFAULT '0',
`pktime` int(8) NOT NULL DEFAULT '0',
`groupid` int(10) unsigned NOT NULL DEFAULT '0',
`class` tinyint(4) NOT NULL DEFAULT '0',
`level` mediumint(8) unsigned NOT NULL DEFAULT '0',
`lfp` tinyint(1) unsigned NOT NULL DEFAULT '0',
`lfg` tinyint(1) unsigned NOT NULL DEFAULT '0',
`mailkey` char(16) NOT NULL,
`xtargets` tinyint(3) unsigned NOT NULL DEFAULT '5',
`firstlogon` tinyint(3) NOT NULL DEFAULT '0',
`inspectmessage` varchar(256) NOT NULL DEFAULT '',
PRIMARY KEY (`id`),
UNIQUE KEY `name` (`name`),
KEY `account_id` (`account_id`)
) ENGINE=MyISAM AUTO_INCREMENT=1 DEFAULT CHARSET=latin1;
-- Initial population of the character_lookup table --
INSERT INTO `character_lookup` (id, account_id, `name`, timelaston, x, y, z, zonename, zoneid, instanceid, pktime, groupid, class, `level`, lfp, lfg, mailkey, xtargets, firstlogon, inspectmessage)
SELECT id, account_id, `name`, timelaston, x, y, z, zonename, zoneid, instanceid, pktime, groupid, class, `level`, lfp, lfg, mailkey, xtargets, firstlogon, inspectmessage
FROM `character_`;

View File

@ -630,6 +630,9 @@ bool Client::Save(uint8 iCommitNow) {
return false;
}
/* Mirror Character Data */
database.StoreCharacterLookup(this->CharacterID());
return true;
}

View File

@ -3226,3 +3226,11 @@ bool ZoneDatabase::GetFactionIdsForNPC(uint32 nfl_id, std::list<struct NPCFactio
}
return true;
}
void ZoneDatabase::StoreCharacterLookup(uint32 char_id) {
std::string c_lookup = StringFormat("REPLACE INTO `character_lookup` (id, account_id, `name`, timelaston, x, y, z, zonename, zoneid, instanceid, pktime, groupid, class, `level`, lfp, lfg, mailkey, xtargets, firstlogon, inspectmessage)"
" SELECT id, account_id, `name`, timelaston, x, y, z, zonename, zoneid, instanceid, pktime, groupid, class, `level`, lfp, lfg, mailkey, xtargets, firstlogon, inspectmessage"
" FROM `character_` "
" WHERE `id` = %i ", char_id);
QueryDatabase(c_lookup);
}

View File

@ -246,6 +246,7 @@ public:
/*
* General Character Related Stuff
*/
void StoreCharacterLookup(uint32 char_id);
bool SetServerFilters(char* name, ServerSideFilters_Struct *ssfs);
uint32 GetServerFilters(char* name, ServerSideFilters_Struct *ssfs);
bool GetAccountInfoForLogin(uint32 account_id, int16* admin = 0, char* account_name = 0,