MySQL Lag
#1

Hi Guys.

I have the MySQL R7 plugin with cache... The MySQL Plugin is making lag on the server and also sometimes they can't login/register because the server is too busy working with mysql functions... MySQL saves every 5 minutes. I dont have mysql_store_result and mysql_free_result because on the official thread says that i don't need in R7 plugin. What do i miss to put or is a plugin bug ?

Example of code...
pawn Код:
forward LoadKukji();
public LoadKukji()
{
    for(new i = 0; i < MAX_HOUSES; i++)
    {
        new szDestination[100];
        mysql_format(handle,szDestination,sizeof(szDestination), "SELECT * FROM `Kukji` WHERE KukjaID = '%d'",i);
        mysql_function_query(handle,szDestination,true,"VcituvanjeKukji","i",i);
    }
    return 1;
}

forward VcituvanjeKukji(kukjaid);
public VcituvanjeKukji(kukjaid)
{
    new rows, fields;
    cache_get_data(rows, fields);

    if(!rows) // Pogresen pass
    {
        return 1;
    }

    new podatok[64];

    cache_get_row(0, 1, podatok);
    HouseInfo[kukjaid][hOwned] = strval(podatok);

    cache_get_field_content(0, "hOwner", podatok);
    strmid(HouseInfo[kukjaid][hOwner], podatok, 0, strlen(podatok), 64);

// ETC..ETC..ETC..ETC..ETC..ETC

    return 1;
}
Reply
#2

It's better to "SELECT * FROM `Kukji`" and then loop through the houses. So, it will be executed only once instead of n times (n = MAX_HOUSES).

By the way, saving every 5 minutes for houses is pointless. If someone buys a house, insert it to the database. If someone sells a house (not owning it anymore), delete it from the database and so on.
Reply
#3

Okay, so i've changed to update houses, apartments etc on payday and fixed the loops

REP +
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)