improve paste repository to utilize database index