Learn how to use NHibernate Profiler
- Avoid too many joins
- Different parameter sizes result in inefficient query plan cache usage
- Don’t Query from the View
- Ends with query (like '%...') will force the database to scan the full table
- Excessive number of rows returned
- Large number of individual writes
- More than one session per request
- Multiple write sessions in the same request
- Queries & data binding shouldn’t mix
- Select N+1
- Select N+1 in the same request
- Superfluous update - use inverse='true'
- Too Many Cache Calls In The Same Request
- Too many cache calls per session
- Too many database calls in the same request
- Too many database calls per session
- Transaction disposed without explicit rollback / commit
- Unbounded result set
- Use of implicit transactions is discouraged
- Using a single session in multiple threads is likely a bug