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) 2 years ago
activities Reduce usage of `db.DefaultContext` (#27073) 2 years ago
admin Next round of `db.DefaultContext` refactor (#27089) 2 years ago
asymkey Reduce usage of `db.DefaultContext` (#27073) 2 years ago
auth Next round of `db.DefaultContext` refactor (#27089) 2 years ago
avatars Fix context cache bug & enable context cache for dashabord commits' authors (#26991) 2 years ago
db Improve DeleteByID (#26904) 2 years 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) 2 years ago
git Search branches (#27055) 2 years 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) 2 years ago
packages move repository deletion to service layer (#26948) 2 years ago
perm move repository deletion to service layer (#26948) 2 years ago
project Refactor project templates (#26448) 2 years ago
pull refactor some functions to support ctx as first parameter (#21878) 2 years ago
repo Add `RemoteAddress` to mirrors (#26952) 2 years ago
secret Refactor secrets modification logic (#26873) 2 years 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) 2 years ago
unit Use `Set[Type]` instead of `map[Type]bool/struct{}`. (#26804) 2 years ago
unittest Replace `interface{}` with `any` (#25686) 2 years ago
user Next round of `db.DefaultContext` refactor (#27089) 2 years 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) 2 years 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) 2 years ago
org_team_test.go Reduce usage of `db.DefaultContext` (#27073) 2 years ago
org_test.go Implement FSFE REUSE for golang files (#21840) 2 years ago
repo.go move repository deletion to service layer (#26948) 2 years ago
repo_test.go Implement FSFE REUSE for golang files (#21840) 2 years ago
repo_transfer.go Next round of `db.DefaultContext` refactor (#27089) 2 years ago
repo_transfer_test.go Next round of `db.DefaultContext` refactor (#27089) 2 years ago