Open Bug 1251064 Opened 10 years ago Updated 6 years ago

Retrieving products from /rest/product is too slow when component flag types are included

Categories

(bugzilla.mozilla.org :: API, defect)

Production
defect
Not set
normal

Tracking

()

People

(Reporter: kohei, Unassigned)

References

()

Details

(Keywords: perf)

Loading https://bugzilla.mozilla.org/rest/product?type=accessible takes 45 seconds for me, maybe because of the duplicated flag_types?
Keywords: perf
Assignee: webservice → nobody
Component: WebService → API
Product: Bugzilla → bugzilla.mozilla.org
QA Contact: default-qa
Version: unspecified → Production
If excluding the component flag types, the response will be much faster. https://bugzilla.mozilla.org/rest/product?type=accessible&exclude_fields=components.flag_types
Assignee: nobody → dylan
Status: NEW → ASSIGNED
See Also: → 1511558
Summary: Retrieving products from /rest/product takes too long → Retrieving products from /rest/product is too slow when component flag types are included

Can we just remove flags from the API? That's the bottle neck, and it's hard to optimize because of the include/exclude nature of the flag implementation.

The following SQL query is executed 2170 times, at a cost of 6ms per call. Because of the inclusion/exclusion logic I'm not sure we could do the same thing with 1 call.

SELECT 
    flagtypes.id
FROM
    flagtypes
        INNER JOIN
    flaginclusions AS i ON flagtypes.id = i.type_id
        LEFT JOIN
    flagexclusions AS e ON (flagtypes.id = e.type_id
        AND (e.component_id = 2113
        OR e.component_id IS NULL)
        AND ((e.product_id = 127)
        OR e.product_id IS NULL))
WHERE
    1 = 1
        AND (i.product_id = 127
        OR i.product_id IS NULL)
        AND (i.component_id = 2113
        OR i.component_id IS NULL)
        AND e.type_id IS NULL LIMIT 1000
Assignee: dylan → nobody
Status: ASSIGNED → NEW
You need to log in before you can comment on or make changes to this bug.