[Zope] ZCatalog queries performance

Sebastian Tänzer st at taenzer.me
Tue May 19 10:54:16 CEST 2015

Thanks for the feedback and help, Tres. 

Let’s say I want to display an accordion with all events of a month displaying quite a lot of data about the event (30-50 events on one page, collapsible jQuery accordion). At the moment I get the results and put the objects into the result set via unrestrictedTraverse using getPath(). Would it be better to only get the path and get the object in the template? Does this make any difference performance wise?

Which data of the event objects would I keep as ZCatalog meta columns and which not? Documentation is not really helpful on this.

The tricky part is that events are linked with different locations (event location, selling points) that are not children of the event object but objects in a different folder. The event object itself only keeps the links to these location objects and I get them when iterating over the result set in the template.

Any advice what would be the best way for this performance-wise?
Is it okay to get the object itself via traversal? Is there a faster way to get the object data?

> Am 17.05.2015 um 19:37 schrieb Tres Seaver <tseaver at palladion.com>:
> Hash: SHA1
> On 05/17/2015 11:09 AM, Sebastian Tänzer wrote:
>> What are the alternatives?
> The most performant implementation would be to generate the URL for the
> image using a fixed suffix (relative to the result object).  E.g., ::
>  <ul>
>    <li tal:repeat="event context/listEvents">
>      <a href="event/getUrl">
>       <img src="string:{event/getUrl}/event_image" />
>       <span tal:content="event/title">TITLE</span>
>      </a>
>    </li>
>  </ul>
> You could achieve that fixed suffix either by mandating a fixed object
> ID for the image, or by adding a method / view to the event which
> redirected to the actual image URL.
> Tres.
> - -- 
> ===================================================================
> Tres Seaver          +1 540-429-0999          tseaver at palladion.com
> Palladion Software   "Excellence by Design"    http://palladion.com
> Version: GnuPG v1.4.11 (GNU/Linux)
> va4ZgWEjQtFuSlzHOf30CGKIEwNX+EAYWw6juMznQo/4Yq5b2g4Ur8cA9q1gYgFB
> 2ZwW4/W4wKsaAJxQ6sckinAKhlWGJugXdpcxnbbU3V0ePoUtgPsO0GVIlPoDV+WF
> /qEnWYWTu+7xHf/DV5iiHKTqYM0Oqv1aNTuZd9s8/emHoDuU8RpzVLscZuJEYk+B
> 5mdFFSfNJ9wer79fxQH8yM+8Vz6IkVx4XCCTa9/9QM9qHTVLqvv+AllbtolQ4gms
> ASkisuW7p/XvJgK5bMbUFvEkDZQQDMFAuRKe2lnVT6rAFXiR04fHk6GKKtW3WyEb
> Cdq4GYcKz4ZYdF4l2QV8h+FOZRAf6qWW9CCiRsuihaiYB57Uk8hI/GPk00TXL78z
> rmOWtZ86d7hlCarP8k+T+1b5b+RQUB8danop21ys3SeH+FMiEPxjIuhY0i43n6xQ
> dg6HJ8ry7KihYipaRJrC0tqVFluToWFdLUaM1qRSJHpcKi3TpHKiKXGzNSHzeI1y
> GD7zb3HF+lYqsy74wPWIp/flSmJxJMg5givfHt96/sFvaaNstvjIY6KiKUUW0JMy
> 8b/fF4ufHu2ZGoT8TSMCZRa4KpNMcat9Edo/MsgOeir65a3PnFj9Br8DmpZJwTbV
> =U40Y
> _______________________________________________
> Zope maillist  -  Zope at zope.org
> https://mail.zope.org/mailman/listinfo/zope
> **   No cross posts or HTML encoding!  **
> (Related lists -
> https://mail.zope.org/mailman/listinfo/zope-announce
> https://mail.zope.org/mailman/listinfo/zope-dev )

More information about the Zope mailing list