optimize the stream key duplication check