use multithread to do the query