I was reading a blog-post of Ben Scheirman about some NHibernate tweaks he made in order to increase the performance.
In the end of article there is:
Lesson #7: Always make sure you’ve set hibernate.default_schema
What does he mean by hibernate.default_schema
?
I'm not a dba so I can't give you a good definition of schema... (to me it is just 'database' in SQL Server).
In NHibernate you can specify the schema two places: in the mapping files, in the configuration.
The Mapping File lets you specify schema per class. This is good when you have classes coming from different schema in the same server.
The SessionFactory configuration lets you specify a default schema (default_schema option) that should be applied to all class mappings that don't explicitly set their schema. So its a catch all.
From reading your link it seems this is beneficial in performance because when you query table "Bar" without specifying the schema (say database is "Foo" so schema "Foo.dbo" in SQL Server) the query plan isn't cached. This is probably due to the SQL Server having to try and resolve which schema to use by your connection string (Initial Catalog, Database, etc) instead of having it explicit in the query ("Bar" implicit - not cached, "Foo.dbo.Bar" explicit - cached).
Again, I'm not a dba so these definitions suck :)
edit:
Here is a link to the configuration stuff (for NH 1.2 ... which is old ... but the default_schema option is there):
https://www.hibernate.org/hib_docs/nhibernate/1.2/reference/en/html/session-configuration.html
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With