MySQL speed problem?
#1

A few days ago, I decided to switch to the mysql system from Y_INI. I read on the forum that mysql is faster than Y_INI system, but that's not the case.

I create one timer which saves just 1 variable for every player, every 5 minutes, and, this is result:
http://prntscr.com/fw06oy

This is query:
Код:
format(MySQLStringMINI,sizeof(MySQLStringMINI),"UPDATE `users` SET `PayDay` = '%d', `LastActivity` = NOW() WHERE `Name` = '%s'", Player[i][PayDay], GetName(i));	  
mysql_query(MySQLStringMINI);
I don't know why, but, this isn't good results, i had better results with Y_INI, why?

And yes, this is MySQL server information:
http://prntscr.com/fw07sy

I'm using MySQL R5 plugin on CentOS. That dedicated machine have so good resources(4x3.1GHz 32GB DDR3...)
Reply
#2

I don't know much but aren't you supposed to use threaded queries instead? because I heard they are faster
Reply
#3

Why R5? https://github.com/pBlueG/SA-MP-MySQL/releases/latest
Reply
#4

It is faster if you know how to use it correctly. For instance, searching a player by name is much slower than searching a player by unique ID and should be avoided. The only time you search by name is when the player first joins. For every query after that you use the unique ID. Look up information about keys and indexes in SQL and how and when to use them. Also have a look at the EXPLAIN keyword. Furthermore if you send 300 queries in one second (in a loop, probably) while the average is maybe 10 queries a second then of course you will see a spike. It doesn't take a genius to figure that out.

Also WHY are you still using R5 when we're currently at R41 which is MUCH more efficient?
Reply
#5

Right, make sure you're on local host, remote queries take a long time to process.
Also refer to Vince, and use the latest version of MySQL or atleast the latest R39 version if you're too lazy to learn the new version.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)