Which is faster Aggregate Count vs Returning Data + JS .length

Hi! Loving Dgraph so far.

I have a question about speed and which one is better to do. I have a simple notification system for an app I am creating. When a user logs in, I look up the notifications they haven’t seen based on a lastSeen DateTime. I run a query that gets all the notifications that are more recent than that time with @search on the time field. Which is working fine.

Question - is it faster to do the query as an aggregateNotifictions and get the count OR do a queryNotifications and get the data then sum it up with JS?

If I do aggregate, I can just get the count and only call the data once the user clicks on notifications icon.

Not sure which one to do.

Count seems like it should be faster? But I am not sure. :slight_smile:

Thanks for any insights!