Scott Watermasysk

Still Learning to Code

NHProf vs. SQL Profiler

NHProf is a profiling tool for NHibernate.

NHibernate Profiler is a real-time visual debugger allowing a development team to gain valuable insight and perspective into their usage of NHibernate.

What really jumped out at me after using it for just a couple of minutes is how much more useful it is for developers than SQL Profiler (assuming you are using NHibernate).

First a couple of screen shots that really tell the whole story:

NHProf

NHProf Screenshot

SQL Server Profiler

Sql Profiler Crappy Screenshot

Which one of the two screen shots cares about the user?

Seriously, if you had to use of these tools daily; would you choose the one that throws up on the screen or the one which tries to make your life easier?

Obviously there is quite a bit more to SQL profiler, but for the things a developer would care about on a daily basis, you cannot beat the following:

  1. Results grouped by session. NHibernate cheats by encouraging a single session to be used per page request, but either way it is a very useful way to view what is happening per request.
  2. Details about the number of records returned per query.
  3. Alerts and Tips pointing you performance improvements

So far, NHProf has been a huge help in understanding how NHibernate translates mappings and queries requests into my object model.

It also makes we wonder why this level of information is not available out of the box via SQL Profiler, but well…nevermind.