beargrylls
beargrylls

Reputation: 21

PHP/MYSQL fastest search solution

The fastest and the best in your opinion search solution for site in PHP/MYSQL is ?

  1. MYSQL FULLTEXT
  2. ZEND LUCENE
  3. PLAIN MYSQL
  4. OTHER SOLUTION

Why this solution ?

Upvotes: 2

Views: 2890

Answers (2)

Pascal MARTIN
Pascal MARTIN

Reputation: 400982

It all depends on :

  • The amout of data you have
  • The complexity of those data
  • The number of search you'll be doing (is fulltext search a major feature of your application ? Or something that will rarely be used ? )
  • The features you want ? Only search ? Or more advanced stuff ?


MySQL Fulltext is not that fast, and not really powerful -- and it forces you to use MyISAM as table engine (InnoDB being probably a better idea, for many situations -- supports transactions, for instance)

Zend Lucene is probably not that fast either ; If I remember correctly, using Zend Lucene is not quite a good idea if you have too many documents (like more than 50,000)

Plain MySQL... You mean using like '%word%' ? That awful, performance-wise : you'll scan each and every lines of your table, each time you're doing a search.


If you really want a great indexing/search solution, you'll probably want to take the time to invest is something else, more specialised, like a specific indexing/searching engine.

As an example, you could take a look at Solr (right now, the website seems to be down), or Sphinx.

Upvotes: 1

krtek
krtek

Reputation: 26597

It depends on your data, the size of them, the search options, etc.

I think the best is to do your own benchmark with the aforementioned solutions. Or eventually give us more insights in your goals and needs, so we can better help.

I'd say, given the datas, plain mysql will be the faster and Lucene the one with the more flexibility.

Upvotes: 0

Related Questions