Jump to content

Recommended Posts

Greetings php community,

 

    I am working on completing a large travel web application that relies upon a world cities database. The team I am working with is running into performance issues when accessing information from an autocomplete. For instance, if you begin to type in the name of a location the time it takes for any predictive cities to appear is not practicably useful. I am not a database programmer and the one that I am working with is not always completely thorough. Would anyone in the community be willing to look at the applications and offer an suggestions? Hope to hear from you.

 

Rico

Link to comment
https://forums.phpfreaks.com/topic/228719-mysql-performance-issues/
Share on other sites

It would be best if you added timing code to the application, so that you could narrow down the problem to a few dozen lines of PHP or a single database query, then post just that small snippet to the board.  Not many people are going to be willing to eyeball your code to look for potential slow spots.

Hi

 

In addition to the above points, make sure the city database you are reading is properly indexed.

 

Also code in a small delay to the Ajax calls to get the auto complete values. Ie, when you detect a key press instead of immediately calling the server set up a timer with a short delay to call to a function to call the server, and after the delay check if the value of the field has changed since the timer was set up. If it has then abandon that call (as the change will have triggered the next call anyway). A 1/4 second delay won't affect peoples perception of the response time but will massively reduce the number of hits on the database from someone typing a city name.

 

All the best

 

Keith

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.