mirror of
https://github.com/flarum/framework.git
synced 2025-01-23 07:37:15 +08:00
0ce00c6d16
Ordering by `is_sticky and (unread subquery) desc` removes MySQL's ability to use an index for ordering by `last_time`, which triggers a filesort across the whole discussions table which is BAD. This commit uses a union to add all stickied discussions to the query. The results of the unioned queries are then ordered by the `is_sticky and (unread subquery)` criteria, so the filesort only takes place on a maximum of limit * 2 rows. Big performance win when you get up to thousands of discussions! |
||
---|---|---|
.. | ||
sticky |