optimized the sql query for partner list api