Improve response time for Projects API default `GET /api/v4/projects`

The response time for GET /api/v4/projects is about 5s. We should fix this as this is our default filter and order-by parameters and we should be able to give snapping response for those (I argue this is more important than for other filter/order combinations, if we wanted to prioritize it).

For an unauthenticated user, the query is

SELECT
    "projects".*
FROM
    "projects"
WHERE
    "projects"."visibility_level" = 20
    AND "projects"."pending_delete" = FALSE
ORDER BY
    "projects"."created_at" DESC,
    "projects"."id" DESC
LIMIT 20 OFFSET 0

This translates into a 4.4s query even with hot caches: https://explain.depesz.com/s/RbN2

Edited Nov 12, 2019 by Andreas Brandl
Assignee Loading
Time tracking Loading