Building a representation of one entry should not take more than 1 database request

Bug #251284 reported by Leonard Richardson
2
Affects Status Importance Assigned to Milestone
Launchpad itself
Invalid
Low
Unassigned

Bug Description

Building a representation of a bug takes several database requests to get the bug's tags, permits_expiration, can_expire, and is_complete. This is especially bad because permits_expiration, can_expire, and is_complete all make basically the same query: one that gets all of a bug's tasks. This leads to a lot of database queries when getting a collection of bugs.

As a temporary measure we've removed permits_expiration, can_expire, and is_complete from the bug's representation. There are two long-term solutions we're considering. The first is to show a stripped-down representation in collections and expect clients to follow the self_link if they want more information about an entry. The second is to populate behind-the-scenes caches so that an entire page of bugs can have their permits_expiration, can_expire, and is_complete populated with a single database request.

Curtis Hovey (sinzui)
Changed in launchpad-foundations:
status: New → Triaged
importance: Undecided → Low
tags: added: api
Revision history for this message
Robert Collins (lifeless) wrote :

This is a special case of a larger pattern which was discussed recently on the -dev mailing list: object iterators returned by the API collection code trigger many potato-programming behaviours, generating many hundred, or thousands, of DB roundtrips. So possibly this should be generalised and raised in priority.

Revision history for this message
Robert Collins (lifeless) wrote :

I"m going to mark this invalid - we eager load things sufficient to get 0 db queries per object (some N per API request instead).

Changed in launchpad:
status: Triaged → Invalid
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.