tsilenzio Posted July 29, 2007 Share Posted July 29, 2007 I was wondering what would be better for computer resources and speed wise if lets say I got about anywhere from 3,000 - 6,000 people on my site at once if I: Loaded information from mysql once and then loaded the needed variables into the the SESSION variable (Things like if you want to receive emails, your signature in a forum) -- OR -- Loaded the information from mysql as often as possible and keep the minimal amount of variables inside SESSION (Things like UserID, AuthID) Thanks alot in advance! - tsilenzio Quote Link to comment https://forums.phpfreaks.com/topic/62269-sessions-vs-mysql-database/ Share on other sites More sharing options...
Foser Posted July 29, 2007 Share Posted July 29, 2007 I try to store a lot in sessions. Like information that is used allot throughout the page. Keep in mind that every query you have is slowing down the execution rate. But if you already have a set value as a session for user name email and information you use alot, than you won't need to slower the execution rate with mysql queries. Quote Link to comment https://forums.phpfreaks.com/topic/62269-sessions-vs-mysql-database/#findComment-309901 Share on other sites More sharing options...
PC Nerd Posted July 29, 2007 Share Posted July 29, 2007 the other thing to keep in mind, is if your storing things in your session, that really need to be in the database. I have had this problem with my game, where i place like Points in teh session, but forget to update teh DB, so i end up having everything working for that on euser, btu the other users arent experienceing anything. Keep that in mind as well Quote Link to comment https://forums.phpfreaks.com/topic/62269-sessions-vs-mysql-database/#findComment-309990 Share on other sites More sharing options...
tsilenzio Posted August 4, 2007 Author Share Posted August 4, 2007 Okay but what if you store something in the game that you plan to put in the database like lets say the users money if its a php game, they buy / sell 50 things each so their money is completly diffrent, but they leave the game up, or theyexit the browser before they go to a page that updates their info into the database? =/ Quote Link to comment https://forums.phpfreaks.com/topic/62269-sessions-vs-mysql-database/#findComment-315501 Share on other sites More sharing options...
lightningstrike Posted August 4, 2007 Share Posted August 4, 2007 Don't store data that needs to be processed by others such as "money", "points". Update the database. The session should be used for personal static preferences e.g. timezone, template, username, ip, lastvisit etc. Quote Link to comment https://forums.phpfreaks.com/topic/62269-sessions-vs-mysql-database/#findComment-315504 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.