[thelist] php/mysql speed

Eric Engelmann eric.engelmann at geonetric.com
Mon Apr 8 14:27:01 CDT 2002


Session would be bad, I'd think. Why create copies of it in RAM for every
user, unless its different for every user?

In ASP, I'd query the db once at Application start and place the array in
Application scope, then, depending on the complexity of the logic, parse and
organize it on each page. If it was super complex, I'd pre-parse it and
store maybe a series of strings in Application scope and place the
appropriate one on each page, maybe by section. Then you refresh it by
updating the application var(s). Much better to take up 100k of RAM (cheap!)
than to constantly hit your db.

You could also write the content out to a single .php file with the logic in
it, ready to go, say, daily or by some update mechanism? How often does the
structure change? Disk access is MUCH faster than db call, especially if
you're just include/require-ing it in PHP.

But yes, definitely do not query the db on each page if possible, but I'd
stil vote that over sessions to store multiple copies of the same data in
RAM. Ack.

- E




More information about the thelist mailing list