Suppose I run a query that retrieves all unpaid invoices owed to my company. Now, I want to get the total of those invoices. Which is more efficient / performant? Run a GROUP BY SQL query or do a JS .reduce on the original query's data? Does anyone know if there is a clear winner overall, even though certain tasks might be faster one way and other tasks faster the other way?