0

I want code not cause load on server to find similar posts in php/mysql

I try with

MATCH (post) AGAINST ('string string')

but it was cause alot of load on server, so it stop my server for

I have over 4,125,274 post in my database

please help mE

3
  • What does your database look like? Do you have 4 million records in one table?
    – ale
    Feb 25, 2012 at 14:48
  • Yes, vbulletin comments (posts)
    – mrKoring01
    Feb 25, 2012 at 14:58
  • I suppose you have a fulltext index on post?
    – stryba
    Feb 25, 2012 at 17:25

2 Answers 2

4

While Fulltext index will help, it will be still really slow if you want to load similar items many times. We have an implementation which has about 7 million records of posts with fulltext and it takes maybe up to a minute to search if we only rely on mysql.

A good alternative is having a search server like sphinx http://sphinxsearch.com/ which creates its own indexing and caching and is much much faster. It is simple and efficient and is used by many big places like urbandictionary, craiglist, mozilla, etc.

If you want to do it in only mysql queries, and if you don't want to do one search many times, try caching the returned IDs on memcached.

0

Supposing you already have a fulltext index on post and this doesn't help you should consider incorporating a dedicated search engine on your posts, such as Lucene (not necessarily the php implementation though)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.