Activity.restrict_deactivated_users has a massive impact on certain queries
Environment
- Installation type (OTP or From Source): From source
- Pleroma version (could be found in the "Version" tab of settings in Pleroma-FE): Latest master w/additions, 2.4.51-353-gc85b278f-develop
- Elixir version (
elixir -v
for from source installations, N/A for OTP): 1.10.4 - Operating system: Ubuntu 20.04
- PostgreSQL version (
psql -V
): 12.8
Bug description
I had a user report being unable to view their timeline, logs showed the standard ecto timeouts. I duplicated the query to play around with it, and tried removing parts of the query at random to find out what was taking time, since there was no obvious difference between my user and the user experiencing the issue. A large part was thread containment, which has been known about for a while, but the more interesting one was deactivated users
when not excluding deactivated users, the query time dropped 70% - there's already an index on is_active so I'm not sure what might cause this
timings attached
Edited by Sadposter