1
0
Fork 0
forked from forgejo/forgejo

[GITEA] Use join for the deleting issue actions query

- The action tables can become very large as it's a dumpster for every
action that an user does on an repository.
- The following query: `DELETE FROM action WHERE comment_id IN (SELECT id FROM comment WHERE
issue_id=?)` is not using indexes for `comment_id` and is instead using
an full table scan by MariaDB.
- Rewriting the query to use an JOIN will allow MariaDB to use the
index.
- More information: https://codeberg.org/Codeberg-Infrastructure/techstack-support/issues/9
- Backport https://codeberg.org/forgejo/forgejo/pulls/1154
This commit is contained in:
Gusted 2023-07-29 16:59:23 +02:00 committed by Gusted
parent e7d0475e15
commit 9b71369be9
6 changed files with 45 additions and 7 deletions

View file

@ -35,6 +35,6 @@ func TestNodeinfo(t *testing.T) {
assert.Equal(t, "forgejo", nodeinfo.Software.Name)
assert.Equal(t, 25, nodeinfo.Usage.Users.Total)
assert.Equal(t, 18, nodeinfo.Usage.LocalPosts)
assert.Equal(t, 2, nodeinfo.Usage.LocalComments)
assert.Equal(t, 3, nodeinfo.Usage.LocalComments)
})
}