# Very slow sql queries on user login

**URL:** <https://forum.gitea.com/t/very-slow-sql-queries-on-user-login/9685>\
**Category:** Install/Maintain/Configure\
**Created:** [September 6, 2024, 1:18pm UTC](https://forum.gitea.com/t/very-slow-sql-queries-on-user-login/9685 "2024-09-06T13:18:40Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![s-hell](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.gitea.com/s-hell/32/6236_2.png) [@s-hell](https://forum.gitea.com/u/s-hell)\
**Post date:** [September 6, 2024, 1:18pm UTC](https://forum.gitea.com/t/very-slow-sql-queries-on-user-login/9685/1 "2024-09-06T13:18:40Z")

</div>

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?
