Skip to content

GitLab

  • Menu
Projects Groups Snippets
    • Loading...
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in
  • G gitlabhq1
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 21
    • Issues 21
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 12
    • Merge requests 12
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
  • Deployments
    • Deployments
    • Environments
    • Releases
  • Monitor
    • Monitor
    • Incidents
  • Packages & Registries
    • Packages & Registries
    • Package Registry
    • Infrastructure Registry
  • Analytics
    • Analytics
    • CI/CD
    • Repository
    • Value stream
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • gpt
  • large_projects
  • gitlabhq1
  • Merge requests
  • !2451

Closed
Created Jan 01, 2013 by Administrator@rootOwner
  • Report abuse
Report abuse

Optimize Projects sidebar performance

  • Overview 4
  • Commits 1
  • Changes 7

Created by: jirutka

Projects on sidebar contains their last activity, i.e. creation date of the last event associated with the project. Performance issue with the current implementation is that it generates extra query for every project in sidebar and every time when user open the Dashboard page. I have about 30 projects in my sidebar so that means 30 hits to database just to get last activity date of projects.

SELECT "events".* FROM "events" WHERE "events"."project_id" = 7 AND (author_id IS NOT NULL) ORDER BY events.created_at DESC LIMIT 1

This patch eliminates these extra queries entirely and thus significantly reduces load time of sidebar with many projects. Instead of querying for the last event to read its created_at, we can just read project’s updated_at attribute which is touched (i.e. updated) while any event that belongs to the project is saved (see http://goo.gl/X4mOJ for example).

Note: I’ve run tests on my machine with MRI 1.9.3-p327 and all passed.

Assignee
Assign to
Reviewer
Request review from
Time tracking
Source branch: github/fork/jirutka/sidebar-perf