1
0
mirror of https://github.com/go-gitea/gitea.git synced 2024-11-04 08:17:24 -05:00

Speed up loading the dashboard on mysql/mariadb (#28546)

Fixes #28155
This commit is contained in:
Lunny Xiao 2024-01-14 22:34:25 +08:00 committed by GitHub
parent 97292da960
commit fa8c3beb26
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -446,8 +446,11 @@ 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
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()