Ayende @ Rahien

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


+972 52-548-6969

, @ Q c

Posts: 6,007 | Comments: 44,761

filter by tags archive

The little query that could

time to read 2 min | 226 words

It looks likes I still have a lot to learn about NHibernate, today I took a foray into criteria's projections, which are new and exciting to me, but what excites me right now is this little puppy. It is not that the query is terribly complicated, it is that this is traversing six tables as easily as it can be. From the Multi Query reference, you can probably understand why I am excited, I need to get ~6 results sets for this to work, and it is looking like this is going to be very easy to do it in a performant way.

(Image from clipboard).png

You have to realize, I am at the point when I am running passing tests in the debugger, just to check out how cool this is. In the time that it took me to write this post, I have implemented the bare bones of what is most probably the hardest part of the system. This particular functionality requires data from 30(!) tables. The final query is over 5Kb in size, and goes on for 3 pages. (I am talking about the final query, not the one above.)

And to forestall the obvious questions, yes, I use this color scheme sometimes, I amuses me.


Pete w

Dont let anyone make fun of your color scheme. I use almost the exact same colors on my VS, with the resharper bracket highlites.

Its been the default colors of vim since the early 90s (I bet)...

Ken Egozi

I'd do that too if I've had the time to set it up. Maybe you can share the settings export file?


Honestly, when I see more than 4 tables in a query, or a series of queries, I start thinking I need some views or UDFs in my database.

Ayende Rahien

Well, there are conceptually only two things in the query, customer and profile, the problem is that they are interconnected in interesting ways to the user, so basically this is a query for:

Give me the customers and profiles that are associated with the user, no matter how.

Comment preview

Comments have been closed on this topic.


No future posts left, oh my!


  1. Speaking (3):
    23 Sep 2015 - Build Stuff 2015 (Lithuania & Ukraine), Nov 18 - 24
  2. Production postmortem (11):
    22 Sep 2015 - The case of the Unicode Poo
  3. Technical observations from my wife (2):
    15 Sep 2015 - Disk speeds
  4. Find the bug (5):
    11 Sep 2015 - The concurrent memory buster
  5. Buffer allocation strategies (3):
    09 Sep 2015 - Bad usage patterns
View all series



Main feed Feed Stats
Comments feed   Comments Feed Stats