Is there a way to use the ANSI 'TABLESAMPLE' from an ICriteria-based
based query?  My scenario is that we have a fairly large (~20 million
rows) table and want to sample ~10K rows, count them, then add
runtime-created filters and count the results to extrapolate the final
result; the REAPEATABLE clause for TABLESAMPLE allows me to guaranteed
the same rows being selected for each sample.

Pseudo-code:

IMultiCriteria mc = theSession.CreateMultiCriteria();
DetachedCriteria sampleCount =
DetachedCriteria.For<MyEntity>().SetProjection(Projections.RowCount());
// need to add TABLESAMPLE (xx rows) REPEATABLE(seed)
DetachedCriteria matchCount =
DetachedCriteria.For<MyEntity>().Add(Criteria.Foo()) ...
.SetProjection(Projections.RowCount());

mc.Add(sampleCount).Add(matchCount);


Thanks in advance,

Pete Appleton

-- 
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.

Reply via email to