You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
gitea/models
Giteabot c3b7120042
Add index to `issue_user.issue_id` (#27154) (#27158)
Backport #27154 by @JakobDev

This fixes a performance bottleneck. It was discovered by Codeberg.
Every where query on that table (which has grown big over time) uses
this column, but there is no index on it.

See this part of the log which was posted on Matrix:
```
2023/09/10 00:52:01 ...rs/web/repo/issue.go:1446:ViewIssue() [W] [Slow SQL Query] UPDATE `issue_user` SET is_read=? WHERE uid=? AND issue_id=? [true x y] - 51.395434887s
2023/09/10 00:52:01 ...rs/web/repo/issue.go:1447:ViewIssue() [E] ReadBy: Error 1205 (HY000): Lock wait timeout exceeded; try restarting transaction
2023/09/10 00:52:01 ...eb/routing/logger.go:102:func1() [I] router: completed GET /Codeberg/Community/issues/1201 for [::ffff:xxx]:0, 500 Internal Server Error in 52384.2ms @ repo/issue.go:1256(repo.ViewIssue)
```

Co-authored-by: JakobDev <jakobdev@gmx.de>
1 year ago
..
actions Next round of `db.DefaultContext` refactor (#27089) 1 year ago
activities Reduce usage of `db.DefaultContext` (#27073) 1 year ago
admin Next round of `db.DefaultContext` refactor (#27089) 1 year ago
asymkey Reduce usage of `db.DefaultContext` (#27073) 1 year ago
auth Next round of `db.DefaultContext` refactor (#27089) 1 year ago
avatars Fix context cache bug & enable context cache for dashabord commits' authors (#26991) 1 year ago
db Improve DeleteByID (#26904) 1 year ago
dbfs Fix content holes in Actions task logs file (#25560) 2 years ago
fixtures Replace 'userxx' with 'orgxx' in all test files when the user type is org (#27052) 1 year ago
git Search branches (#27055) 1 year ago
issues Add index to `issue_user.issue_id` (#27154) (#27158) 1 year ago
migrations Add index to `issue_user.issue_id` (#27154) (#27158) 1 year ago
organization Next round of `db.DefaultContext` refactor (#27089) 1 year ago
packages move repository deletion to service layer (#26948) 1 year ago
perm move repository deletion to service layer (#26948) 1 year ago
project Refactor project templates (#26448) 1 year ago
pull refactor some functions to support ctx as first parameter (#21878) 2 years ago
repo Add `RemoteAddress` to mirrors (#26952) 1 year ago
secret Refactor secrets modification logic (#26873) 1 year ago
shared/types Display owner of a runner as a tooltip instead of static text (#24377) 2 years ago
system Fix context cache bug & enable context cache for dashabord commits' authors (#26991) 1 year ago
unit Use `Set[Type]` instead of `map[Type]bool/struct{}`. (#26804) 1 year ago
unittest Replace `interface{}` with `any` (#25686) 2 years ago
user Next round of `db.DefaultContext` refactor (#27089) 1 year ago
webhook Replace `interface{}` with `any` (#25686) 2 years ago
error.go Sync branches into databases (#22743) 2 years ago
fixture_generation.go Implement FSFE REUSE for golang files (#21840) 2 years ago
fixture_test.go Implement FSFE REUSE for golang files (#21840) 2 years ago
main_test.go move repository deletion to service layer (#26948) 1 year ago
org.go refactor some functions to support ctx as first parameter (#21878) 2 years ago
org_team.go Use db.WithTx for AddTeamMember to avoid ctx abuse (#27095) 1 year ago
org_team_test.go Reduce usage of `db.DefaultContext` (#27073) 1 year ago
org_test.go Implement FSFE REUSE for golang files (#21840) 2 years ago
repo.go move repository deletion to service layer (#26948) 1 year ago
repo_test.go Implement FSFE REUSE for golang files (#21840) 2 years ago
repo_transfer.go Next round of `db.DefaultContext` refactor (#27089) 1 year ago
repo_transfer_test.go Next round of `db.DefaultContext` refactor (#27089) 1 year ago