Removes the sub-query to improve speed