optimize queries for improved performance