improve aggregate fuction call