I am trying to use ajax autocompletion for a textbox. Should I fetch data from the database for every keystroke? If I do so, it is getting delayed. What is the technique to make it fast loading?
On first keystroke pull in all matching values with one call to database then you javascript to pare down the array returned via ajax, if this array is to large (test number of members) Then make a second call to database with next keystroke.
Better yet, test record count server side, while it is to large, do not respond and let client side script keep sending requests until count is below a threshold then send response. of course all this depends on indexes for speed.