Warning: Can't synchronize with repository "(default)" (Unsupported version control system "svn": No module named svn). Look in the Trac log for more information.

Ticket #286 (closed enhancement: fixed)

Opened 14 years ago

Last modified 12 years ago

[PATCH] Speedup for certain catwalk joins.

Reported by: bbockelm@… Owned by: anonymous
Priority: normal Milestone: 0.9
Component: Toolbox Version:
Severity: normal Keywords: catwalk, SOMultipleJoin
Cc:

Description

When catwalk tries to count the number of objects in a multiple join (in the browse tab, when you have a SOMultipleJoin), it does it in a silly way:

value='%s'% len(getattr(row,columnjoinMethodName?))

In SQLObject, this loads all the objects in the join into a list, then counts the items in the list.

Alternately, you can just perform the correct select, and use the SQLObject count method. This greatly increases the speed of rendering the pages (especially when there are more than 1000 objects in the join).

The attached patch does this.

Attachments

catwalk-join-speedup.diff Download (2.0 KB) - added by bbockelm@… 14 years ago.
diff against catwalk.py, svn revision 336.
catwalk_join_speedup.diff Download (2.0 KB) - added by bbockelm@… 14 years ago.
Updated to handle problems gracefully

Change History

Changed 14 years ago by bbockelm@…

diff against catwalk.py, svn revision 336.

comment:1 Changed 14 years ago by michele

  • Summary changed from Speedup for certain catwalk joins. to [PATCH] Speedup for certain catwalk joins.

comment:2 Changed 14 years ago by kevin

  • Status changed from new to closed
  • Resolution set to fixed

committed in [408]. Thanks!

comment:3 Changed 14 years ago by bbockelm@…

  • Status changed from closed to reopened
  • Resolution fixed deleted

Changed patch to reflect concerns voiced by Ronald; previously, the patch didn't work with relatedJoins. On the attached file, it now has the speedup for multipleJoins and it falls back to the previous naive implementation for relatedJoins.

Ronald also thought there would be problems when there is no foreign key, but this shouldn't be a problem as a foreign key is needed for a multipleJoin to work anyway...

Unfortunately, doing a similar speedup for relatedJoins will be a bit more difficult, as SQLObject sets up a separate table. Until then, the updated patch will do.

Changed 14 years ago by bbockelm@…

Updated to handle problems gracefully

comment:4 Changed 14 years ago by ronald@…

  • Status changed from reopened to closed
  • Resolution set to fixed

Commited in 429, thanks for the update Brian!

Note: See TracTickets for help on using tickets.