tweak query to use indexes