We are using Hibernate.
Unfortunately it seems the index didn’t help when you try to order the whole set of events, MySQL still resorts to file sort and takes more than 10 minutes (at which time the client timed out and I gave up for the time). Some googling suggests splitting the table up into smaller tables to perform this types of queries on huge tables…
When you say hibernate specific enhancements, are you takling about the use of fetchSize instead of BatchingIterators setFirstResult and setMaxResults? When turning on hibernate SQL-logging it seems it is doing the exact same thing (a sequence of selects with … limit 101, 100; … limit 201, 100 etc) but in addition it starts of with a select without the limit part (which takes forover (more than 10 minutes)). Very strange and not really functional : ) … Even without the first select every batchs select takes longer and longer time, resorting to file sort after a couple of million events and then the queries no longer seem tractable.
However, for the case we are working on the moment we currently only need replay per customer and that seems to be doable by keeping a list of aggregates associated to the customer and joining that with DomainEventEntry to get the domain events for that particular customer.