Ayende @ Rahien

Hi!
My name is Oren Eini
Founder of Hibernating Rhinos LTD and RavenDB.
You can reach me by phone or email:

ayende@ayende.com

+972 52-548-6969

, @ Q c

Posts: 5,968 | Comments: 44,488

filter by tags archive

RavenDB’s Dynamic Reporting


One of the nice things about having more realistic demo data set is that we can now actually show demos on that data. I didn’t realize how much of an issue that was until we actually improved things.

Let us see how we are going to demo RavenDB’s dynamic reporting feature.

We start by creating the following index. It is a pretty simple one, with the one thing to notice is that we are explicitly setting the Sort mode for Total to be Double.

image

Now that we have done that, we are going to go to Query > Reporting:

image

And then I can start issue reporting queries:

image

This is the equivalent of doing:

select EmployeeID, sum(tot.Total) Total from Orders o join 
    (
        select sum((Quantity * UnitPrice) * (1- Discount)) Total, OrderId from [Order Details]
        group by OrderID
    ) tot
    on o.OrderID = tot.OrderID
where o.CustomerID = @CustomerId
group by EmployeeID

The nice thing about this, and what makes this feature different from standard map/reduce, is that you can filter the input data into the aggregation.

In code, this would look something like this:

session.Query<Order>("Orders/Total")
  .Where(x=>x.Company = companyId)
  .AggregateBy(x=>x.Employee)
  .SumOn(x=>x.Total)
  .ToList();

Pretty nice, even if I say so myself.


Comments

Thomas Freudenberg

Who said NoSQL is inappropriate for reporting scenarios?

Stephen Hardie

From the blogs and articles I've read this is what was holding me back from using RavenDB. It's great to be able to provide reporting options in the management studio.. but is there any know reporting products that work with RavenDB?

Ayende Rahien

Stephen, RavenDB is still not primarily meant for reporting. We support replication to RDMBS, which would be your reporting db.

Nathan Palmer

This looks pretty interesting as we evaluated RavenDB for reporting purposes several months back. If you say it's not meant (primarily) for reporting then what is the use-case for this feature? Is it well suited for an OLAP environment or not very well optimized for it?

Matt Johnson

Stephen - I'm fairly sure it will work with most reporting solutions, at least those that give you full control of the datasource. I plan to test this pretty hard with Stimulsoft Reports (www.stimulsoft.com) in the future. I bet it would work with ActiveReports and others as well.

Ayende Rahien

Nathan, It is for reporting, but reporting is still not a primary feature. This is to give you some reporting capabilities, and it is pretty optimized right now. But note that most reporting solutions would want to control the data source themselves. Any reporting tool that give allow you to provide it with the data source should work.

Ayende Rahien

Matt, I would love to have a post about this when you are done.

Comment preview

Comments have been closed on this topic.

FUTURE POSTS

No future posts left, oh my!

RECENT SERIES

  1. Career planning (6):
    24 Jul 2015 - The immortal choices aren't
  2. Production postmortem (4):
    23 Jul 2015 - The case of the native memory leak
  3. API Design (7):
    20 Jul 2015 - We’ll let the users sort it out
  4. What is new in RavenDB 3.5 (3):
    15 Jul 2015 - Exploring data in the dark
  5. The RavenDB Comic Strip (3):
    28 May 2015 - Part III – High availability & sleeping soundly
View all series

RECENT COMMENTS

Syndication

Main feed Feed Stats
Comments feed   Comments Feed Stats