Session variables or DB query

Questions about the MySQL, PostgreSQL, and most other databases, as well as using it with PHP can be asked here.

Moderator: General Moderators

Post Reply
karimyehia
Forum Newbie
Posts: 1
Joined: Thu Dec 23, 2010 5:00 am

Session variables or DB query

Post by karimyehia »

Hello all,

I am not an experienced PHP/MySQL developer. I have been studying them for two weeks now but I have already made good projects and I think I am getting the hang of it. I just have a question for the experienced people. When people log in to websites like facebook for example. Do all their related information: messages, notifications, friend, images, etc get registered in session variables or is it just the userid and the DB is queried each time the user wants new information?
From a technical point of view, both can work, I am just concerned about the real world when databases are huge and millions of users might be querying the DB at the same time?

Thanks
User avatar
Technical
Forum Commoner
Posts: 81
Joined: Thu Dec 02, 2010 5:30 am

Re: Session variables or DB query

Post by Technical »

karimyehia wrote:Hello all,

I am not an experienced PHP/MySQL developer. I have been studying them for two weeks now but I have already made good projects and I think I am getting the hang of it. I just have a question for the experienced people. When people log in to websites like facebook for example. Do all their related information: messages, notifications, friend, images, etc get registered in session variables or is it just the userid and the DB is queried each time the user wants new information?
From a technical point of view, both can work, I am just concerned about the real world when databases are huge and millions of users might be querying the DB at the same time?

Thanks
You should never stores any data in Session except session key.
Post Reply