Hi Richard,

Assuming you've optimised the query as much as possible, I'd consider using memcached: http://php.net/manual/en/book.memcache.php. Great for caching the response of slow queries.

Cheers,

Rob

Richard Lake wrote:
Part of the reason for the complexity of the query is that the supplier list
is reduced based on relevance for the type of search, typically I'd guess
that there'd be 10 to 20 suppliers.

-----Original Message-----
From: [email protected] [mailto:[email protected]] On Behalf
Of Todd Martin
Sent: 02 February 2010 22:08
To: [email protected]
Subject: Re: [phpug] PHP session variables vs database cache


Hi Todd,

....and another thing.

If your "supplier" list is large, it can't be a pleasant experience for
the user to have to scan through a huge drop down list until he/she
finds the right supplier. Also the data populating your select list must
be pulled across the internet, which is going to be far slower than
pulling that data across your server network. So caching the query
results on the server won't give you nearly as much performance gain as
paginating the "supplier" data.

The query produces a list of contacts that have characteristics specific
to
that particular search screen, eg suppliers, and is used to populate a
drop
down list. The query to populate the drop down list won't change during
the
search, however the query that produces the search results will, for
example
the user may select a different supplier from the search list or may
narrow
the price range or some other search criteria that is on the search page.

Regards

Richard
-----Original Message-----
From: [email protected] [mailto:[email protected]] On Behalf
Of Todd Martin
Sent: 02 February 2010 21:10
To: [email protected]
Subject: Re: [phpug] PHP session variables vs database cache

Hi Richard


I have a fairly complex query that runs against 3 MySQL tables to
produce a list of contacts that are used to populate a select list.
The select list may need to be rebuilt a number of times as the user
refines their search. The query won't vary and the likelihood that the
results will vary are low enough that saving the results in a session
variable is acceptable. I'd expect that the user would peruse the
results for 10 to 60 seconds before refining their search.
What do you mean, "the query won't vary?" Surely, everytime the user
refines the search, the query changes. Doesn't it?

My question is: should I save the query results in a session variable
for reuse or is the database efficient enough to cache the query results?

Thanks and regards

Richard

--
NZ PHP Users Group: http://groups.google.com/group/nzphpug
To post, send email to [email protected]
To unsubscribe, send email to
[email protected]

--
NZ PHP Users Group: http://groups.google.com/group/nzphpug
To post, send email to [email protected]
To unsubscribe, send email to
[email protected]




__________ Information from ESET NOD32 Antivirus, version of virus signature 
database 4833 (20100203) __________

The message was checked by ESET NOD32 Antivirus.

http://www.eset.com

--
NZ PHP Users Group: http://groups.google.com/group/nzphpug
To post, send email to [email protected]
To unsubscribe, send email to
[email protected]

Reply via email to