I have impleneted paging using an Oracle interface and I have a question about scalability. The query generated by NHibernate (2.1.1 GA) via the ICriteria appears to be ineffecient. If I SetFirstResult(1) and SetMaxResults(25) it will return ROWNUM <= 25 and ROWNUM > 1. What happens if I allow users to skip to a specific page which contains the 2,000,000th row. I would SetFirstResult(2000000) and SetMaxResults(25) which would result in the NHibernate processing my a query that selects ROWNUM <= 2000025 and ROWNUM > 2000000. Here is the code which NHibernate generates:
select * from ( select row_.*, rownum rownum_ from (SELECT .......) row_ where rownum <= :p0) where rownum_ > :p1;p0 = 2000025, p1 = 20000000 ----------------------------------------- or--------------------------------------------- select * from ( select row_.*, rownum rownum_ from (SELECT .......) row_ where rownum <= 2000025 ) where rownum_ > 2000000 Can someone explain what is happening here? Is NHibernate selecting all 2,000,025 rows? -- You received this message because you are subscribed to the Google Groups "nhusers" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/nhusers?hl=en.
