Skip to content

Commit

Permalink
Speed up loading the dashboard on mysql/mariadb (go-gitea#28546)
Browse files Browse the repository at this point in the history
  • Loading branch information
lunny authored and GiteaBot committed Jan 14, 2024
1 parent 56e722f commit 125fdb9
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions models/activities/action.go
Original file line number Diff line number Diff line change
Expand Up @@ -446,9 +446,12 @@ func GetFeeds(ctx context.Context, opts GetFeedsOptions) (ActionList, int64, err
return nil, 0, err
}

sess := db.GetEngine(ctx).Where(cond).
Select("`action`.*"). // this line will avoid select other joined table's columns
Join("INNER", "repository", "`repository`.id = `action`.repo_id")
sess := db.GetEngine(ctx).Where(cond)
if setting.Database.Type.IsMySQL() {
sess = sess.IndexHint("USE", "JOIN", "IDX_action_c_u_d")
}
sess = sess.Select("`action`.*"). // this line will avoid select other joined table's columns
Join("INNER", "repository", "`repository`.id = `action`.repo_id")

opts.SetDefaultValues()
sess = db.SetSessionPagination(sess, &opts)
Expand Down

0 comments on commit 125fdb9

Please sign in to comment.