enhancementhelp wantedoptimization
Description
Querying for things like:
- latest (as in, biggest TIMESTAMP) event for a certain scope (say, reference=R1)
- sum/avg/max/min for a certain scope (say, reference=R1)
is quite expensive as it involved a lot of scanning (as can be seen in https://github.com/eventsourcing/es4j/blob/master/eventsourcing-queries/src/main/java/com/eventsourcing/queries/IsLatestEntity.java and https://github.com/eventsourcing/es4j/blob/master/eventsourcing-queries/src/main/java/com/eventsourcing/queries/LatestAssociatedEntryQuery.java)
Proposed solution: designate and formalize an aggregate indexing system.