Batching

Total execution time of a NHibernate query constitutes of three things:

  • Time it takes to send the query to remote database server
  • Time it takes to execute actual SQL on the database server
  • Time it takes to return the results to client, process the results on client, and hydrate the entities

Depending on what kind of queries you are writing, you may be spending a lot of time sending your queries to remote database server. In such a situation, you can batch multiple SQL statements together and send them to database server for execution in one roundtrip. Batching does not impact the time it takes to execute actual SQL on the server, but reduces the network time as you are doing a single database interaction against several you would have done ...

Get Learning NHibernate 4 now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.