Add `first` aggregate function in SQL.
Merge branch 'master' into index-query-performance
Clean up some queries on index.
Merge branch 'master' into index-query-performance
Jbuilder is hard to understand
More opimizations

- Move last poster name into view.
- Query counts with subforums.
More optimizations.

- Move creator_name into threads_with_visited_status
- Eliminate redundant selects.
- Refactor subforum jbuilder template to use optimizations
Rename NewThreadsQuery to RecentThreadsQuery
Indexes and optimizations for threads_with_visited_status.
Slight slow-down, but no N+1 queries in the view.
Use includes instead of reimplementing it for thread creators.
Save author id of last post in a thread on the thread.
Super fast single query index page!
Refactor SubforumGroupIndexQuery
Use a delegate class instead of relying on private preloading APIs.
Docstring update
Avoid extra queries when accessing a subforum.
Use posts.by_number where necessary
Remove unused delegate class.
Remove unused query