Move query processing after the check for prepared statement cache