Tom Evans wrote:
> On Fri, Dec 11, 2009 at 4:04 PM, Jean Stebens <neme...@twilightzone.lu> wrote:
>> Daniel Roseman wrote:
>>> On Dec 11, 2:51 pm, Jean Stebens <neme...@twilightzone.lu> wrote:
>>>> Hi there,
>>>>
>>>> I have a rather large set of objects in my database, around 200k, using
>>>> the django admin interface and listing them is always terrible slow as
>>>> it always fetches all entries (paginated). I usually just run a few
>>>> searches or add some filters on the list. Is there a way to have the
>>>> list not shown initially until I do add some filters/searches?
>>>>
>>>> Cheers,
>>>> Jean
>>> This seems strange. Are you talking about the changelist view? This
>>> never fetches all objects - it only fetches the objects for one page
>>> at a time.
>>> --
>>> DR.
>>>
>> Yes, I'm talking about the changelist in the admin interface. With my
>> current set of 200k entries I have 1990 pages each containing 100 entries.
>>
>> applying a filter on that initial list makes it load relative fast. I've
>> tried commenting out any calculated fields when displaying the objects,
>> but that doesnt improve the performance, my best guess is the initial
>> "show all" queryset set off by the framework.
>>
>> Cheers,
>> Jean
>>
> 
> Do you have custom sorting on that model? Eg, setting 'ordering' on
> the models meta class?
> 
> You need to look at the SQL query being generated for your initial
> query and figure out why it is slow. Ordering by a field that is not a
> dbindex would require a full table scan in most db engines, and that
> would be quite slow.
> 
> Once you restrict the elements by a filter that is indexed, that would
> speed it up so that you would not notice ordering by an unindexed
> field.
> 
> Cheers
> 
> Tom

The default ordering for the object is set on it's id, which is defined
as primary key for the object. The complete database is optimized in
terms of indexes as this is a live monitoring system with more than 40k
servers.

Any idea how to get the generated SQL from django? (except capping it in
innotop)

Cheers,
Jean

--

You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@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