Re: SESSIONS vs. MySQL

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Sep 20, 2008, at 7:28 AM, Ashley Sheridan wrote:

On Fri, 2008-09-19 at 10:17 -0500, Philip Thompson wrote:
Hi all.

Let me start out by saying, I have STFW and read through the list
archives. Now that that's out of the way.

To speed up our application, we want to implement using SESSIONs in
some locations. Beforehand, on every page, we would run approximately
30-40 queries just to get the page setup - user information and other
stuff. Now while we can't take away all of the setup queries, we would
like to reduce the startup number.

Ok, so I've implemented this in several places where information
basically does not change from page to page. Jumping to the point/
question... when does it become more inefficient to store lots of
information in SESSION variables than to run several more queries?
Note, we are actually storing sessions in the database - so a read/
write is required on each page load - it's not file sessions.

Now I know this can depend on the complexity of the queries and how
much data is actually stored inside the sessions... but initial
thoughts? To give you a number, the strlen of the _SESSION array is
325463 - which is equivalent to the number of bytes (I think).

Thanks,
~Philip

Why do you have so many queries? Is there any way you could use joins to
drop that number down. It might not seem like  lot when only a few
people are using the site, but it will start being a problem when you
get more people using it.


Ash

Well, there are different queries depending on how *far* you get into the app. If you fail at level 2, why already grab the data that's need at level 5 or 6? And besides, using joins is expensive. The queries pull different data - if there's no relation between tables, a join won't work. However, because the database is normalized (to the 3rd degree), we use joins all over the place.

~Phil


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


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux