Combobox

I have a situation in which the options for an autocomplete field is obtained from a complex join query. The join query itself needs to be dynamically built, and therefore, cannot be stored as a view.

I feel that using ajax would take significant time and load the server.

There can be anywhere between two to ten thousand options for this field. Is it advisable to store the data locally, as normally done in a combobox (as shown in the jquery-ui website/combobox extension)? Or is it still better to use ajax?

Or is there some other better way to do it?