Welcome to dbForumz.com!
FAQFAQ    SearchSearch      ProfileProfile    Private MessagesPrivate Messages   Log inLog in

Caching MySQL Search Query & Results

 
   Database Forums (Home) -> PHP RSS
Next:  Unexpected EOF encountered in BCP data-file  
Author Message
SC3

External


Since: Oct 11, 2004
Posts: 1



(Msg. 1) Posted: Wed Nov 23, 2005 12:48 pm
Post subject: Caching MySQL Search Query & Results
Archived from groups: comp>lang>php (more info?)

I'm developing a site that may eventually have a very large database of
users (hopefully, but who knows). It will be a community website where
users can search each other (think Friendster, Classmates, every dating site
out there, etc.).

Often there will be queries with multiple joins and sometimes may include a
few fulltext searches. Each page of results will have a limited number of
results displayed (obviously). As I understand it, MySQL caches only exact
queries, so doing a LIMIT (x,y) on each query to get results for the
specific page will cause MySQL to run the entire query again, instead of
pulling from the cache. I will limit the results to 1000, but what's the
best way to limit results per page?

I was thinking that I could run the SELECT and LIMIT to 1000, then do a
mysql_data_seek to jump to the starting row for the page and fetch a certain
number of rows for the page. For each page, the exact same SELECT would be
used and therefore the results would be cached.

Also, how should I save the search query? The users will be searching with
any number of search terms, way too many to do use GET variables. I don't
want to create a hidden form with each search term as hidden inputs (for
one, that's kind of lame). I was thinking of saving the search query to the
database, I guess I could implode the POST array into a string and then save
it in the db.

Any suggestions for either of these issues that might work better? Any help
would be greatly appreciated.

Thanks!

 >> Stay informed about: Caching MySQL Search Query & Results 
Back to top
Login to vote
Mike Willbanks

External


Since: May 05, 2005
Posts: 6



(Msg. 2) Posted: Thu Nov 24, 2005 7:45 pm
Post subject: Re: Caching MySQL Search Query & Results [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

> Also, how should I save the search query? The users will be searching with
> any number of search terms, way too many to do use GET variables. I don't
> want to create a hidden form with each search term as hidden inputs (for
> one, that's kind of lame). I was thinking of saving the search query to the
> database, I guess I could implode the POST array into a string and then save
> it in the db.

What you would probably want to do is store the information in a
serialized array in a file and limit it down from there. However this
is a massively intense data operation. You might want to think about
simply doing a select per each page.

Mike

 >> Stay informed about: Caching MySQL Search Query & Results 
Back to top
Login to vote
Display posts from previous:   
Related Topics:
Query meltdown: caching results - I'm working on a CMS that, in addition to the database-stored version of articles for easy searching, sorting, etc, also stores a HTML file version so pages can be fetched with the minimum of overhead (browsing articles has no more overhead than accessin...

$_SESSION : Speed-up MYSQL Frequent Results - Dear Sirs and Madams, Receive as information that storing a MYSQL result under $_SESSION was accelerating web page displays processes ? Absolutly needed but impossible to get this working ! I try, but do not succeed in implement $_SESSION with MYSQL. ....

php/mysql search - I'm trying to build a form where the user searches for a name, and then all of the names that match are listed. I'd like both of these to appear on the same page. e.g. - +-----------------+ Name: | Jimm | <Go> ...

Looking for a search engine that search a mysql database - I have been using phpdig in some websites but now I stored a lot of larger texts into a mysql database. In the phpdig search engine, when you entered a search word, the page where the search word was found was displayed with about 2 lines before and 2...

sorting query results into groups - Hey, I have a 'staff' table with a column 'status', corresponding to a 'statuses' table with the appropriate titles (eg 1 | Editor in Chief). I want to display on the page the headings (the titles from statuses) along with all of the staff members with....
   Database Forums (Home) -> PHP All times are: Pacific Time (US & Canada)
Page 1 of 1

 
You can post new topics in this forum
You can reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum



[ Contact us | Terms of Service/Privacy Policy ]