Updating grapho, trying to optimize query