Here is the issue I am facing. I have a User model that has_one profile. The query I am running is to find all users that belong to the opposite sex of the current_user and then I am sorting the results by last_logged_in time of all users.
The issue is that last_logged_in is an attribute of the User model, while gender is an attribute of the profile model. Is there a way I can index both last_logged_in and gender? If not, how do I optimize the query for the fastest results?