Display epic related events on user activity feed
What does this MR do?
It adds displaying epic-related activities on user profile.
The query is now much simpler. The problem with the original query was that it joined projects but we don't have project for epic-related events.
Queries
- I used myself as the user
Original query
- columns list replaced with
*
here - query plan: https://explain.depesz.com/s/ijVq
SELECT * FROM (
SELECT
"projects".*
FROM
"projects"
INNER JOIN "user_interacted_projects" ON "projects"."id" = "user_interacted_projects"."project_id"
WHERE
"user_interacted_projects"."user_id" = 508743) AS projects_for_join
JOIN (
SELECT
"events".*
FROM
"events"
WHERE
"events"."author_id" = 508743) AS events ON events.project_id = projects_for_join.id
INNER JOIN "projects" ON "projects"."id" = "events"."project_id"
LEFT OUTER JOIN "project_features" ON "project_features"."project_id" = "projects"."id"
LEFT OUTER JOIN "project_import_data" ON "project_import_data"."project_id" = "projects"."id"
LEFT OUTER JOIN "namespaces" ON "namespaces"."id" = "projects"."namespace_id"
LEFT OUTER JOIN "users" ON "users"."id" = "events"."author_id"
ORDER BY
"events"."id" DESC
LIMIT 20
New query
When ordering by created_at
- query plan: https://explain.depesz.com/s/zGnVK
SELECT "events".* FROM "events" WHERE "events"."author_id" = 508743 ORDER BY "events"."created_at" DESC LIMIT 20
when ordering by id (old version)
- query plan: https://explain.depesz.com/s/wWq2
SELECT "events".* FROM "events" WHERE "events"."author_id" = 508743 ORDER BY "events"."id" DESC LIMIT 20
Screenshots (strongly suggested)
Does this MR meet the acceptance criteria?
Conformity
-
Changelog entry - [-] Documentation (if required)
-
Code review guidelines -
Merge request performance guidelines -
Style guides -
Database guides -
Separation of EE specific content
Availability and Testing
-
Review and add/update tests for this feature/bug. Consider all test levels. See the Test Planning Process.
Related to #196835 (closed)
Edited by Jarka Košanová