0

I tried to apply autocomplete option retrieving data from database. The reference link used - http://www.jqueryautocomplete.com/jquery-autocomplete-php-mysql-json-example.html

It worked well, but the question I have is:

The data gets popped up after a slight delay of 2 seconds, How can I increase the timer such that it gets displayed (almost) instantly?

Thanks in advance! Samuel Mathews.

Steve P
  • 162
  • 1
  • 11
Samuel Mathews
  • 171
  • 1
  • 2
  • 17

2 Answers2

1

probably the response to your question is about speeding up your query or whatever you do in the server side,if is against a database try to use indexes and well known optimizing tips. check this link for more tips. http://www.catswhocode.com/blog/10-sql-tips-to-speed-up-your-database`

General Electric
  • 1,176
  • 3
  • 21
  • 44
0

Your problem is that you are getting data slower than you expect. You are limited by the speed at which your database returns the results. I can suggest you following to speed up.

Front End: jQuery autocomplete has a default delay of 300 miliseconds between keystroke and service call You might want to reduce that.

Back end 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.

  1. If possible cache the results in php, so that you dont hit the db everytime.

  2. 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
Subhash
  • 311
  • 1
  • 8