open.mp forum
[Pawn] QUESTION about MYSQL - Printable Version

+ open.mp forum (https://forum.open.mp)
-- Forum: SA-MP (https://forum.open.mp/forumdisplay.php?fid=3)
--- Forum: Pawn Scripting (https://forum.open.mp/forumdisplay.php?fid=10)
--- Thread: [Pawn] QUESTION about MYSQL (/showthread.php?tid=2099)



QUESTION about MYSQL - redex - 2021-06-05

hi , i was wonder which one is better to use for getting player data from database when he logged-in , i have about user in my data base and i have to select user from this amount of users , currently i use something like this :



pInfo[playerid][score] = mysql_get ...

pInfo[playerid][skinid] = mysql_get ...

pInfo[playerid][money] = mysql_get ...



i mean i have 1 query per item! and i think this will make server LAG , should i get all items in a SELECT * query and then put them in variables? does it make any diffrent to avoid lag ? sorry i know my english is AWFUL but i guess i made my point!


RE: QUESTION about MYSQL - Radical - 2021-06-05

One query for per item makes lag.
Get all in one query.

(2021-06-05, 11:35 AM)redex Wrote: does it make any diffrent to avoid lag?
Yes.

Also upgrade to the latest version of MySQL (r41-4) if you are still using the older version.


RE: QUESTION about MYSQL - redex - 2021-06-05

(2021-06-05, 12:39 PM)Radical Wrote: One query for per item makes lag.

Get all in one query.



and if i am not wrong its just related to select right? i mean only select have cache i dont use cache in others (like insert, delete or ...) so on that cases it will not make such a lag right? i mean its a little bit to hard to save the account in one query, i do the saving on player disconnect and all his stats will save there and there are a lot items that need to be saved, so its hard to put them all in one single query