SQL Query lag
#1

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.
Reply
#2

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.
Reply
#3

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?
Reply
#4

I actually fixed it by using mysql_pquery instead of mysql_tquery as pquery sends simultaneous queries.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)