Re: Mysql strategy

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, 2006-11-14 at 00:51 +1100, David Tulloh wrote:
> Dotan Cohen wrote:
> > If I have to perform 30 LIKE searches for different keywords in a
> > varchar field, which strategy would be recommended:
> > 1) 30 searches, one for each keyword
> > 2) To select the varchar field from all the rows, and search through
> > them with php's array functions?
> 
> It's not going to make a great deal of difference if you do the 
> processing in the MySQL or the PHP, in this case it's basically the same 
> operation in each.  I suspect that efficiently recreating the LIKE 
> functionality in PHP wouldn't be trivial to do, if you are just doing 
> straight comparisons the MySQL STRCMP function should be faster.
> 
> If you are worried about the speed of this query I'd suggest rethinking 
> your database structure.  Text field comparisons will always be 
> relatively slow compared to numeric comparisons or numeric lookups.  My 
> reading of this query however is that it should be 30 OR comparisons, no

Except that most search engines refine the search when you add more
keywords in contrast to your suggestion of expanding the search :)

Cheers,
Rob.
-- 
.------------------------------------------------------------.
| InterJinn Application Framework - http://www.interjinn.com |
:------------------------------------------------------------:
| An application and templating framework for PHP. Boasting  |
| a powerful, scalable system for accessing system services  |
| such as forms, properties, sessions, and caches. InterJinn |
| also provides an extremely flexible architecture for       |
| creating re-usable components quickly and easily.          |
`------------------------------------------------------------'

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux