The translation from name to id is cached. I am not sure whether that is necessary, however. My original patch used a JOIN instead.