Quote:
Originally Posted by PlayStation
you need to understand, that the lagging comes from querying process during gameplay, which affects fps and if every players queries 500k rows no wonder it lags
if you would separate players for example by nickname you will have 10-30k in each table maybe, also i don't think all players are active, you could speed up your SELECT'ion if you just check which players are active
|
Yes, I know the lag is from querying 500k rows during gameplay.
Yes, I'm trying to separate rows by Steam_ID. (player_id)
Here is some nVault code that pulls it off
---------------------------------------------------------
Save:
PHP Code:
formatex(vaultkey, charsmax(vaultkey), "%s-quests", SteamID)
iPos = num_to_str(TotalQuests[id], vaultdata, charsmax(vaultdata))
vaultdata[iPos++] = ' '
for(new i; i < iQuestCount; i++) {
iPos += formatex(vaultdata[iPos], charsmax(vaultdata) - iPos, "%i ", iQuestLevel[id][i])
}
nvault_set(gVault, vaultkey, vaultdata)
Load:
PHP Code:
formatex(vaultkey, charsmax(vaultkey), "%s-quests", SteamID)
nvault_get(gVault, vaultkey, vaultdata, charsmax(vaultdata))
argbreak(vaultdata, szVal, charsmax(szVal), vaultdata, charsmax(vaultdata ))
TotalQuests[id] = str_to_num(szVal)
for(new i; i < iQuestCount; i++) {
argbreak(vaultdata, szVal , charsmax(szVal) , vaultdata , charsmax(vaultdata))
iQuestLevel[id][i] = str_to_num(szVal)
}
Now compare it to my current SQL
---------------------------------------------------------
Save:
PHP Code:
// Now we need to save the skill levels!
for ( new iSkillID = 0; iSkillID < MAX_SKILLS; iSkillID++ )
{
formatex( szQuery, 511, "REPLACE INTO `skills` ( `player_id` , `skill_id` , `skill_level` ) VALUES ( '%d', '%d', '%d' );", iUniqueID, iSkillID, p_data_skill[id][iSkillID] );
query = SQL_PrepareQuery( g_DBConn, szQuery );
}
Load:
PHP Code:
// Select the right Table
format( szQuery, charsmax( szQuery ), "SELECT `skill_id`, `skill_level` FROM `skills` WHERE ( `player_id` = '%d' );", p_data[id][PLAYER_UNIQUEID] );
query = SQL_PrepareQuery( g_DBConn, szQuery );
// While we have a result!
new iSkillID = 0;
while ( SQL_MoreResults( query ) )
{
iSkillID = SQL_ReadResult( query, 0 );
p_data_skill[id][iSkillID] = SQL_ReadResult( query, 1 );
SQL_NextRow( query );
}