Revert "Speed up loading the dashboard on mysql/mariadb (#28546)" (#29006) (#29007)

Backport #29006 by @lunny

This reverts commit fa8c3beb26. #28546
Because it seems performance become worse.

Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
(cherry picked from commit a0b9bd2febdf2aca8f8d162da4f09c0a89b13033)
This commit is contained in:
Giteabot 2024-02-01 18:58:44 +08:00 committed by Earl Warren
parent faafccbcc7
commit af98a0a7c6
No known key found for this signature in database
GPG key ID: 0579CB2928A78A00

View file

@ -448,12 +448,9 @@ func GetFeeds(ctx context.Context, opts GetFeedsOptions) (ActionList, int64, err
return nil, 0, err
}
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")
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")
opts.SetDefaultValues()
sess = db.SetSessionPagination(sess, &opts)