]> cat aescling's git repositories - mastodon.git/commit
Optimize Status#permitted_for 500x (account timeline) (#5373)
authorunarist <m.unarist@gmail.com>
Fri, 13 Oct 2017 14:53:44 +0000 (23:53 +0900)
committerEugen Rochko <eugen@zeonfederated.com>
Fri, 13 Oct 2017 14:53:43 +0000 (16:53 +0200)
commita1c54220e8e79c4bb0cc20da193888388efe2ba4
tree620c89e19be38f488b49edb0529ea2128bc416c2
parentdf7dbc41ae08647a02b2171fd1bfce143acec610
Optimize Status#permitted_for 500x (account timeline) (#5373)

The main change of this PR is removing `order by visibility` hack.

This was introduced to force using of `index_statuses_on_account_id` instead of PK index, but it seems no longer needed probably due to `index_statuses_on_account_id_id`. Removing this avoids reading all rows, so really improves first fetching of the user who has lot of statuses.

I have also changed JOIN to IN + subquery, which slightly faster in most cases.
app/models/status.rb