preparing query service