MySQL Optimization for Server
#1

So i am getting a "hang" when i exit the server in the server.exe
heres what kind of functions I have ongamemodeinit, that i believe are slowing me down
I aim to ask for some points in the right direction to enhance my coding, better my mysql knowledge and improve this script method im using

ALSO: is there anyway to replace for( with foreach(? ive been trying for a while now, because ive had problems without foreach with playerids etc in the past and have had to recode to foreach
pawn Code:
LoadMySQLTable()
{
    printf("===================================================================");
    printf("|+|+|+|+|+| Loading mysqltable From the MySQL Database |+|+|+|+|+|");
    printf("===================================================================");
    new rows;
    mysql_query(g_SQL, "SELECT * FROM `mysqltable` ORDER BY `id` ASC");
    if(cache_get_row_count(rows))
    {
        for(new r = 0; r < rows && r < MAX_MYSQLTABLEROWS; r++)
        {
        }
    }
    printf("%i MYSQLTABLE rows loaded from the Database!", rows);
    return 1;
}
Reply
#2

Quote:
Originally Posted by ******
View Post
Profile it and read "use the index Luke".
thank you, will read through this, found the website and am beginning to read it awesome!
Reply
#3

Quote:
Originally Posted by SkyFlare
View Post
So i am getting a "hang" when i exit the server in the server.exe
https://sampwiki.blast.hk/wiki/MySQL#mysql_close

Quote:

mysql_close will always wait until all queued queries are executed, thus halting the server.

Update data when they change, do not update EVERYTHING when the server closes. Less queries and less data to update at that time will reduce the "hang" time.
Reply
#4

Quote:
Originally Posted by Calisthenics
View Post
Update data when they change, do not update EVERYTHING when the server closes. Less queries and less data to update at that time will reduce the "hang" time.
I do this anyway.... :P thanks though....

the "hang" im getting is when the server closes, but when the server closes, there shouldnt be much to append to MySQL as it changes as im updating.

I just read Data from MYSQL to display it currently and create the objects/data associated to the values, it doesnt get changed.

like Loading Default Gang HQ entrances,
faction/family IDS and all the custom rank names, car colors etc.

then i setup pickups for the xyz pos saved in mysql, all that stuff, only data that really changes is the player data.

but the GM ive started off of was pBlueG's recent login_system-cache.pwn

And it was fine closing when i first got the script haha
Reply
#5

https://sampwiki.blast.hk/wiki/MySQL#my...cessed_queries

Check how many queries are in queque when the server closes. Set log level to ERROR | WARNING | INFO and check how long it takes to execute these queries. Using ALL log level will be slower.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)