I am wondering, what uses less machine overhead... Using session variables to store a bunch of information, or is it better running a MySQL query?
Specificly, this is what I am doing:
I am writing a multiplayer web game. The game gets updates in "ticks", and in between the ticks the user can decide on certain "actions".
During the ticks is when interactions and changes to the world data happen, so a MySQL query MUST happen there. However, in between ticks the user simply sets their actions in an action queue, based on data that is presented. I assumed that I could use session variables to store the data for presentation and interaction, and that way I would only have to run MySQL queries once every tick (about every 5 minutes).
Instead of using session variables, I could also just do MySQL queries each time I draw the page... but I was under the impression that it was slower.
However, some people I have spoken to have said that session variables use much more overhead than MySQL queries, and MySQL queries would be far more efficient.
What are people's general opinions on this? Should I do MySQL queries each time a user does something on the page, or are sessions better?