Jump to content

Sessions VS. MySQL Database


tsilenzio

Recommended Posts

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

Link to comment
https://forums.phpfreaks.com/topic/62269-sessions-vs-mysql-database/
Share on other sites

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.

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 :)

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? =/

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.