Very slow sql queries on user login

I’m encountering slow sql querys when a user tries to login.
The gitea instance is connected to our ldap server.
When a user (that was already login) comes back and opens the website in a new browser tab i see the following error messsage:

2024/09/06 14:20:19 …activities/action.go:461:GetFeeds() [W] [Slow SQL Query] SELECT action.* FROM action INNER JOIN repository ON repository.id = action.repo_id WHERE user_id=? AND is_deleted=? ORDER BY action.created_unix DESC LIMIT 20 [8 false] - 13.77377224s

Running gitea doctor with check-db-consistency gives me the following output:

[1] Check consistency of database

  • [W] Found 10 Topics with empty repository count
  • [W] Found 18 Protected Branches without existing repository
  • [W] Found 278 Action entries without existing user
    OK

All done (checks: 1).

I’m not really why the query is so slow. I tried it directly an get the same results. Any idea?