Hello Kirtti Azad Sahoo
All the retrieve object via association is to connect those two entity attributed. The things which you mentioned will perform as best case when the business model or Logic is satisfied.
For example if u count the total number of employee in a company that gives a single whole number. this will be the best case for 1st option and worst case where you use a follow up sum.
I hope it will be useful
A retrieve followed by an aggregate activity results in one query being done.
If you have the opportunity use a retrieve over association (unless you need specific results or your business logic demands a DB retrieve) and use an aggregate function like Count or Sum.
If the required information isnt in memory anyway a retrieve over association will default to a DB retrieve.
If you want to perform multiple aggregates it, in general, is a good idea to retrieve/aggregate/retrieve/aggregate. As a rule of thumb ofcourse and there are exceptions.