query cycle