optimize entity matching