Comment 2 for bug 736011

Revision history for this message
Curtis Hovey (sinzui) wrote :

I did not finish thinking here. The page timed out iterating over milestones, but the URL is for a ProductRelease which has exactly 1 milestone.

/me looks at rdf

No milestones is listed. This is a very short file. Neither the template or the view are explicitly working with milestones. Nor are there any iterations in the view or template. The template uses the simple values of the release most of the time. It gets the releases Product twice to make URLs, and the productseries once to get its name.

I suspect then that
    string:${context/product/fmt:url}/${context/productseries/name}/+rdf"
is implicitly the cause. I can see in the SQL log that the Product is retrieved, then the ProductSeries is retrieved...which starts a long repetition to get each milestone. The only code that appears to select by milestone is a property:

    @property
    def releases(self):
        """See `IProductSeries`."""
        store = Store.of(self)
        result = store.find(
            ProductRelease,
            And(Milestone.productseries == self,
                ProductRelease.milestone == Milestone.id))
        return result.order_by(Desc('datereleased'))

Oh, is this an open join, or is there an odd query plan created by the And()? I see one product release in the sql log, then hundreds of unmatched milestones. I do not think the And() is needed. I would have written the method as:

    @property
    def releases(self):
        """See `IProductSeries`."""
        store = Store.of(self)
        result = store.find(
            ProductRelease,
            Milestone.productseries == self,
            ProductRelease.milestone == Milestone.id)
        return result.order_by(Desc('datereleased'))