Hi all,

I have a basic search function that uses Q objects.
After profiling it I found that the actual (mysql) database query
finishes in fractions of seconds but the iterating after this can take
up to 50 seconds per 10.000 results.

I have been trying to speed it up but I have had not much results..

My query is this one:

       found_entries = model.objects.filter((Q-objects),
obsolete=0).order_by('-version','docid')

So far so good, but then I need a dictionary to retrieve only unique
'documentid's'.

    rev_dict = {}

This is the part that hurts:

    for d in found_entries:
        rev_dict[d.documentid] = d

And then some more sorting and filtering:

    filtered_entries = rev_dict.values()
    filtered_entries.sort(key=lambda d: d.revisiondate, reverse=True)

Does anyone have some better ideas to achieve this?

Thanks

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.

Reply via email to