SQL Query lag - Printable Version
+- SA-MP Forums Archive (
https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (
https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (
https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: SQL Query lag (
/showthread.php?tid=585828)
SQL Query lag -
PaulDinam - 16.08.2015
So there's been an issue i've been having for some time, for example I have an admin command that gives a player a vehicle. And that command sends a query to insert it into the database and once the query is finished a callback is called to set up the needed info in-game. I sometimes encounter lag spikes that have a delay on the query and the query will have a three seconds delay before the cache gets called. My question is, is there a way to prevent that delay by like preventing the query from being executed again not until it has been executed successfully.
Re: SQL Query lag -
Vince - 16.08.2015
Are you using the MyISAM engine by any chance? Try switching to InnoDB. MyISAM uses table level locking which may be a problem in case of lots of concurrent inserts. InnoDB uses row level locking making this much less of a problem.
Your original inquiry can be solved by setting a variable when the query is sent and unsetting it when it has been processed.
Re: SQL Query lag -
PaulDinam - 16.08.2015
I am using InnoDB but the problem still persists sometimes even though the sql server is hosted on my computer, so setting a variable would solve it you say?
Re: SQL Query lag -
PaulDinam - 17.08.2015
I actually fixed it by using mysql_pquery instead of mysql_tquery as pquery sends simultaneous queries.