you're right, when you don't fire a query on each onkeyup/down. A suggestionbox usually has a listener, which is notified when the user is typing. Either, when your complete result list would not eat all you memory (e. g. some 100 to 1000 elements) you could preload the list and return in the suggestion-listener the needed result (some kind of in-memory sort). The other way would be to let the user type some chars and then make a query to a well indexed data source (DB, Fulltext-Index like Lucene). A complete solution needs some sort of cache to prevent your resources be killed by the system itself...