[Cubicweb] Loading slow a big table using default view

Vincent Michel vincent.michel at logilab.fr
Thu Jan 23 13:41:46 CET 2014

On 23/01/2014 13:33, Sylvain Thénault wrote:
> On 23 janvier 12:24, Jinpeng Li wrote:
>> Dear developers,
>> We found a problem that it is too slow to show a big table using default
>> view. I wrote a description as below with Markdown description. I hope that
>> the description is clear enough to understand. Don't hesitate to let me
>> know if you don't understand any part.
> It's very clear, thank your for that.
>> We guess that the default view may try to load all the data once and show
>> only first 40 items. In our real database, we have 10 million data, it will
>> take more than 1 minute to open web page where only first 40 items have
>> been shown. It would be to better to improve the default view with loading
>> limited number data items.  If there is another possible reason, please let
>> us know. Thanks in advance.
> That may be due to the pagination. Anyway this case deserves investigation.
> Would you open a ticket with the very same description you've just sent?
> thx again, regards,


I have already seen such issue on large database.
Among different tricks that may help you:

  * Remove unused facets:

def registration_callback(vreg):
     # Remove facets
     from cubicweb.web.views.facets import (CWSourceFacet, CreatedByFacet,
                                            InStateFacet, InGroupFacet,
                                            ETypeFacet, HasTextFacet)

  * Avoid fetching "modification_date" and sorting by date in large lists.
     You have to change AnyEntity fetch_attrs to remove the 
"modification_date" order,
     as for now it creates the following request on etype list:

        Any X,AA ORDERBY AA DESC WHERE X is [etype], X modification_date AA

     A quick solution is:

     from cubicweb.entities import AnyEntity
     AnyEntity.fetch_attrs = ()

This should help you.



More information about the Cubicweb mailing list