How fast should be loading 600 houses?
#7

It takes so much because you load 660 times the already loaded data. Do not use loop, the query itself selects ALL the data from the table.

EDIT: That's how it should be assuming hID is set to AUTO_INCREMENT.
pawn Код:
mysql_tquery(server, "SELECT * FROM houses", "LoadHouses","");
pawn Код:
forward LoadHouses();
public LoadHouses()
{
    new rows = clamp(cache_get_row_count(server), 0, sizeof House - 1);
    for(new b; b != rows; ++b)
    {
        House[b][hID] = cache_get_row_int(b, 0);
        House[b][hEnterX] = cache_get_row_float(b, 1);
        House[b][hEnterY] = cache_get_row_float(b, 2);
        House[b][hEnterZ] = cache_get_row_float(b, 3);
        House[b][hExitX] = cache_get_row_float(b, 4);
        House[b][hExitY] = cache_get_row_float(b, 5);
        House[b][hExitZ] = cache_get_row_float(b, 6);
        House[b][hCarX] = cache_get_row_float(b, 7);
        House[b][hCarY] = cache_get_row_float(b, 8);
        House[b][hCarZ] = cache_get_row_float(b, 9);
        House[b][hCarZ] = cache_get_row_float(b, 10);
        cache_get_row(b, 11, House[b][hOwner]);
        House[b][hCost] = cache_get_row_int(b, 12);
        House[b][hInt] = cache_get_row_int(b, 13);
        House[b][hVW] = cache_get_row_int(b, 14);
        House[b][hLock] = cache_get_row_int(b, 15);
        House[b][hKlass] = cache_get_row_int(b, 16);
    }
}
Reply


Messages In This Thread
How fast should be loading 661 houses? - by BloodyRP - 15.04.2016, 13:54
Re: How fast should be loading 600 houses? - by saffierr - 15.04.2016, 13:55
Re: How fast should be loading 600 houses? - by BloodyRP - 15.04.2016, 13:56
Re: How fast should be loading 600 houses? - by Konstantinos - 15.04.2016, 14:41
Re: How fast should be loading 600 houses? - by BloodyRP - 15.04.2016, 15:01
Re: How fast should be loading 600 houses? - by BloodyRP - 15.04.2016, 15:47
Re: How fast should be loading 600 houses? - by Konstantinos - 15.04.2016, 15:49
Re: How fast should be loading 600 houses? - by BloodyRP - 15.04.2016, 15:52
Re: How fast should be loading 600 houses? - by AmigaBlizzard - 15.04.2016, 19:55
Re: How fast should be loading 600 houses? - by BloodyRP - 15.04.2016, 19:59

Forum Jump:


Users browsing this thread: 1 Guest(s)