Closed Bug 1133897 Opened 10 years ago Closed 10 years ago

/api/2/question/?involved=username takes a really long time

Categories

(support.mozilla.org :: Questions, task)

task
Not set
normal

Tracking

(Not tracked)

RESOLVED FIXED

People

(Reporter: rik, Unassigned)

Details

This usually takes more than 3 seconds. We should try to keep this under a second.
I made a PR that makes this about 3x faster in my testing (~2.4s -> ~0.8s on my laptop). It uses a subquery to for the part of the filter that looks at answers a user has given, instead of joins like the normal ORM query uses. https://github.com/mozilla/kitsune/pull/2375/files
Merged in https://github.com/mozilla/kitsune/commit/72bcaf75714880c83013ab199629eb9ce91ed898 I deployed this to prod and stage. It still takes longer than I would like, but my test query went from 4.1s to 2.1s on production. Considering that an unfiltered call to /api/2/question/ just took 1.3 seconds, I think this is good enough for now. The questions database queries are always our slowest. At some point we need to figure out how to make this faster. Not only for the API, but also for the main site. That's another issue though.
Status: NEW → RESOLVED
Closed: 10 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.