Improve performance in database