silverstripe/silverstripe-forum — pull request #101 by halkyon (2014-09-03 06:22:52+00:00)
Title: Fixing getLatestMembers performance when limiting by 1

Uses a more efficient aggregate query, to avoid the database having to
do a filesort on a temporary table because of joining and sorting.
Using RIGHT JOIN in this case appears to be faster, so had to drop back
to straight up SQL instead of using the ORM.

On large Member tables, this reduces the querying from ~400ms in one
to around ~60ms in two (one to get the max ID, and another to fetch
the Member record by ID)

Also removed the administrators group from the query. I don't see why
you'd want to see the latest administrator join the site.