optimize get top merchants and categories