Discard temporary tables and update query planner stats