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
+3
View File
@@ -630,6 +630,9 @@ bool Client::Save(uint8 iCommitNow) {
return false;
}
/* Mirror Character Data */
database.StoreCharacterLookup(this->CharacterID());
return true;
}
+8
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);
}
+1
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,