The task is to process the raw data statistics.
Requests simple aggregate - Select SUM/AVG from a group by (AGE,SEX,DAY,SOURCE). (usually in the group by parameters 10-20 staging). Aggregated data are placed in a separate table and have it done the search with the WHERE in which the same 10-20 parameters.
Now all this case deals with mongodb(aggregation framework), don't like the performance. (Indexes are all in memory like, to optimize mongo is clearly not much more)
Maybe there's a database over sharpened under such tasks?