0

Suppose I have a entity with a id and a name fields. I want to look up those entities by name and I build a database index on the name field .

Now when I use NHibernate QueryOver, can NHibernate utilize the database index on name ?

if a second level cache is used , what algorithm will NHibernate use to find entites by name ?

4
  • What second level cache provider are you using? Mar 27, 2012 at 3:11
  • I am using memcached for Windows.
    – dan_l
    Mar 27, 2012 at 4:21
  • 1
    I'm not sure about what algorithms memcached use, but they are reasonably fast. Note that you will have to configure your entity as using the second level cache in your NHibernate mappings. Mar 27, 2012 at 5:16
  • thanks. I think I did . <cache usage="read-write"/>
    – dan_l
    Mar 27, 2012 at 5:54

1 Answer 1

2

NHibernate ultimately sends SQL to your database server. It is up to the SQL optimizer of your DB server (MySQL, MS SQL Server, etc) to decide whether to use an index or not.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.