Thank you very much for your tips.
I´ll do that.
----- Original Message -----
To: "Ronan Lucio" <ronanl@stripped>
Sent: Tuesday, January 18, 2005 6:36 PM
Subject: Re: Doubt about Performance
"Ronan Lucio" <ronanl@stripped> wrote on 01/18/2005 02:53:39 PM:
> Your tips are realy good but I can´t use cache neither for
> queries nor for pages because our site serves hundreds of
> clients, each one with your own code make a different
> query, returning different rows.
> It would be too many queries to be cached.
> I know I didn´t say it in the previous message.
> Thank you for the help,
You would run your "queries" against your cached data using your web
site's application code. You can create additional arrays to act as
indexes against the data so that you will not need to do a full "array
scan" every time. Load your data into your arrays in the order of the
"customer" parameter, then you have already isolated each customer's data
to a contiguous portion of the data array.
Trust me, if you do it right (sorted and "indexed" data + fast lookup
routine), it should be 10-20 times faster than trying to read through the
same data from the database each and every time ([array search + array
seek + looped scan] instead of [SQL parsing + query processing + net lag +
data transfer time]).
I do not recommend doing this to every page on your site, only to those
pages that handle the highest traffic and only for data that doesn't
change quickly (on the order of several changes per hour or per day, not
several changes per second). For rapidly changing data, data you don't
need often, or unpredictable queries, read the data from the database. It
saves you no time to take the effort to cache that kind of data.
Unimin Corporation - Spruce Pine