MySQL slow response after a period of run-time
#1

If I keep my server up for a few hours, the MYSQL starts to lag. When a player connects to the server, it takes more than 10 seconds for the server to fetch this single query:
PHP код:
mysql_format(sqlszQuerysizeof(szQuery), "SELECT `username` FROM `newrp_users` WHERE `username` = '%s' AND `status` = 4"GetName(playerid));
        
mysql_pquery(sqlszQuery"OnPlayerDataLoaded""d"playerid); 
When usually, it takes less than a second. Does anyone know what could be the cause?
This fixes itself after a gamemode restart.

Additional info:
Server is Linux, I'm using a static version of the plugin and latest version (R39-2).
Reply
#2

What is the server's resource usage when the game starts to lag? Also mind giving the output of (run it in a client like phpMyAdmin):
PHP код:
EXPLAIN SELECT `usernameFROM `newrp_usersWHERE `username` = 'RandomName' AND `status` = 
Put an index on username if you haven't done so already.
Reply
#3

Quote:
Originally Posted by Vince
Посмотреть сообщение
What is the server's resource usage when the game starts to lag? Also mind giving the output of (run it in a client like phpMyAdmin):
PHP код:
EXPLAIN SELECT `usernameFROM `newrp_usersWHERE `username` = 'RandomName' AND `status` = 
Put an index on username if you haven't done so already.
I have never used indexes on MySQL, mind explaining their purpose and contribution to the code?
Note that, I select by username only once, after that I use ID to save data.

Here's the output though.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)