NYCPHP Meetup

NYPHP.org

[nycphp-talk] Need About creating search

Dan Cech dcech at phpwerx.net
Tue Nov 27 17:12:41 EST 2007


Dell Sala wrote:
>>> http://www.sphinxsearch.com/
> 
> On Nov 27, 2007, at 4:37 PM, Rob Marscher wrote:
> 
>> The search only returns the primary keys for the matched records.  You
>> then have to do a separate mysql query to get any extra details... but
>> you'd be surprised how fast searching mysql via those primary keys
>> is.  You don't need any where clause because your search has already
>> been narrowed.
> 
> Cool. But doesn't this require 1 SQL query for each result item? (50
> results per page == 50 queries per page)? I suppose they ARE fast
> queries. I've run into this situation a few times in other contexts. Is
> there a clean way to retrieve records by filtering against a list of
> primary key values, all in one SQL query? Just curious...

SELECT * FROM mytable WHERE myid IN (1,2,3,4)

Dan



More information about the talk mailing list