Improve performance of Topic load - ORDER BY RANDOM

Didn’t know this was still an issue on vanilla. We dropped the random in the database entirely as described here and where able to drop the execute to less than 50ms for suggested topics even with more than a million topics…

This is totally unneeded now as the optimisations I made nullify needing this change.

I can see why created_at is needed there, its the query that is trying to find new topics it takes into account a “start date”.

Added the index and can confirm perf is way better:

https://github.com/discourse/discourse/commit/20bee937b70e04aa5afb09635b8aa85866dee588

Thanks for your help here @DeanMarkTaylor !!! closing this for now I feel it has been fully addressed :slight_smile:

5 Likes