There is still not enough information to give you a meaningful advise.

What kind of structure are you querying? Have you observed the sql
generated by NH to say if there are many queries to load referenced
objects?

What amount of data do you need to make your calculation? Is it
possible to load only the needed columns for the sorting, and only
load full entities of the results that are actually used?

If you can't solve this problem this way you should consider a
solution where it is possible that the sorting is done by the
database. This would allow you to use Paging, query.Enumerator and
stuff like this. This could mean that you need to add some redundancy
to the database when storing the objects. Actually, I can't say what
it means, because I don't know what kind of data you need for your
calculation.


On 7 Aug., 09:21, Sly <[email protected]> wrote:
> Hi,
>
> I'm working with Cyril on this project.
> The aim is to develop a search engine that can sort the results by
> relevance. Some of the relevance rules cannot be calculated by the
> database (I cannot explain precisely why without explaining all the
> project, so please believe me ;-) ).
>
> So, we have to make a first HQL query that returns only the results,
> but not sorted. Then, we must browse each result to calculate its
> relevance. Then we sort. The last two steps are very fast, even with
> more than 100k records.
> So, there's no problem when the HQL query returns a small set of
> objetcs. But when there's a lot of results, the query is very slow,
> and mainly because of the data loading (as explained in the first
> post).
>
> So, to answer to Carlos :
>
> (1) We load only the results, but we load all of the results in one
> time
> (2) We calculate the relevance of each result
> (3) We sort the results by relevance.
>
> The real problem is that we cannot paginate the results by the DB
> because we have to calculate the relevance of each record in memory.
> So we must load all of them in one time.
>
> We'll try a Stateless session as Fabio said.
>
> Thank you.
>
> On 6 août, 17:25, Carlos cubas <[email protected]> wrote:
>
> > Let me understand this clearly....
>
> > (1) You Load All records
> > (2) You Search over loaded records
> > (3) Then Filter
>
> > Sounds to me like a backwards approach....
>
> > I would do the opposite
>
> > (1) Filter on DB
> > (2) Search on Filtered
> > (3) Load records
>
> > -Carlos
>
> > Practice makes perfect, but if no one is perfect, why practice?
>
> > Date: Thu, 6 Aug 2009 16:17:20 +0200
> > Subject: [nhusers] Re: Faster loading of a lot of records to a collection  
> > (100 000 records)
> > From: [email protected]
> > To: [email protected]
>
> > On Thu, Aug 6, 2009 at 3:50 PM, Paco Wensveen <[email protected]> wrote:
>
> > Why do you want to load so many records at once?
> > I load all records from my database for search and calculate relevance 
> > according to some informations.
>
> > Why do you want to use NHibernate instead of plane old sql?
>
> >  I'm trying to use plane old sql, but my objects don't be linked to my 
> > Nhibernate session.
> > --
> > Cordialement,
>
> > Cyril GRAUFFEL
--~--~---------~--~----~------------~-------~--~----~
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