Ayende @ Rahien

It's a girl

NHProf new feature: Expensive queries report

It has been a while since we had a new major feature for the profiler, but here it is:


The expensive queries report will look at all your queries and surface the most expensive ones across all the sessions. This can give you a good indication on where you need to optimize things.

Naturally, this feature is available across all the profiler profiles (NHibernate Profiler, Entity Framework Profiler, Linq to SQL Profiler and Hibernate Profiler).


07/16/2010 10:38 AM by

What is the definition of expensive query? Long execution time? CPU utilization? IO utilization? Heavy locking?

Also, the total cost of query (TCQ for CIOs) is calculated by multiplying single query cost by number of query executions / unit of time

Ayende Rahien
07/18/2010 08:11 AM by
Ayende Rahien

Expensive means took the longest time.

This is calculated on a single query basis, not across all similar queries.

Gian Maria Ricci
07/22/2010 01:56 PM by
Gian Maria Ricci

This tend to be a really really nice feature, but I think that query optimization is best done using a profiler in production environment and finding what is happening during real database usage and in real production machine.

Execution time tends to be different from local sql server, or dev machine respect to production one, but surely this is a nice feature to have.

NHProfiler really rocks.


Ayende Rahien
07/22/2010 02:47 PM by
Ayende Rahien


I agree with you that only on production (or at least QA) you can find the real numbers.

But even on non prod systems, that can give you very strong indications about how things are going

Gian Maria
07/23/2010 12:29 PM by
Gian Maria

Yes, you are right, in dev environment we can have indicators, just to find if some queries are really really bad, and then refinement should be made on QA or Production machine.

In my opinion the problem is in the hardware: some devs have machine with 2 gb ram and they test on local sql server, but numbers are really really different when you run the same set of queries on a 2xXeon, 12 GB ram and a bunch of SAS 15k iSCSI disks :).


Comments have been closed on this topic.