I have one table in which there would be millions of records. The requirement is to the records based on the condition and then total on one of the fields. Selectivity would be around approx 50.
Should I load 50 records in java and then filter and sum of on the field.
Or should I write an aggregate query and get the result.
This java processing can be scaled on multiple servers (Horizontal Scaling)