0

I have the Jquery auto complete currently implemented for searching movie names. I have it starting a 2 characters with a 150ms delay in between.

I have a PHP and Mysql DB behind it that does a like '%term%' search to return the results.

I find this is pretty slow and database intensive.

I tried using Mysql's full text search, but didn't have much luck - perhaps I wasn't using the right match type.

Can someone suggest tweaks to the mysql full text or whether I should go straight to an indexing solution like Lucene or Sphinx and if they work well on partial matches with only 1-3 characters?

endyourif
  • 2,186
  • 19
  • 33

1 Answers1

0

You are limited by the speed at which your database returns the results. I can suggest you following to speed up.

  1. Dont make a new connection to mysql from php for every request. Enable database connection pooling. It improves performance quite a lot. I dont know how to do connection pool in php. This might help.

  2. If possible cache the results in php, so that you dont hit the database everytime.

  3. Use an external service to serve data for autocomplete. Look at Autocomplete as a Service. This relieves you writing backend for autocomplete, produces faster results.

Community
  • 1
  • 1
zeros
  • 36
  • 2