Query and scan best practices