By calculating the necessary counts in the database, we avoid unncessary joins and data transmissions.