> I have a question regarding retrieving the
> information. I have the functionlity in which on every
> user click, system needs to retrieve information for
> particular user and display the page according to the
> retrieved information. Now question is which is the
> scalable solution? (1) Retrieve information from the
> database on each user click. (2) Retrieve information
> from the session (here information is retrieved once
> and stored in the session file on the server, when
> user logs into the system)

Benchmark it and find out yourself.

I'm sure 99% of the people here are going to jump on this and say SESSION is
the way to go, and I'd probably agree with them up front. But the only way
to really tell with your program is to benchmark each possibility. If you're
already establishing a database connection for other uses, then one more
query may not be a big deal versus opening an file and reading it, but
you'll never know the real answer until you try both of them. Now, if you
only use the database connection to get this information, then yeah,
sessions will definitely be faster when you remove the database connection
entirely.

---John Holmes...


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to