We're developing a new product at my company and we're considering the database engine. From my experience Raven would be a good fit but there is one requirement that i'm in doubt. We're going to have to provide "live" statistics based on multiple criteria. My initial idea was to use a Map/Reduce and be done with it but as we went further I realized that I would have to calculate the stats for every single possible relationship and this wouldn't be practical. So I wondered if I couldn't use Facets to provide those stats for me.
Basically let's suppose I have an Order object that has a { ShopId, SellerId, BuyerId, Status (Open, Completed, Failed), ...bunch of Props }. I have to provide how many orders a seller has with a buyer and how many orders a seller has with given shop and the same stats for the Buyer and a given shop, grouped by the Status.
What is the better alternative? Having a single Orders_Index that I query and generate facets grouped by the status? Having a Map/Reduce? Or just creating a OrderStats and caching it in Raven, so that when a order is updated we would update the related OrderStats documents accordingly?