I noticed in the app that these queries were slowwww! I was able to track it down to a bad query plan, as we explain in the comment. I searched online for "mysql query performance filter on one join table sort by another", and was surprised to find this answer suggest a subquery, which I've often been told to expect to be slower compared to joins? But it certainly worked in this case! https://stackoverflow.com/questions/35679693/mysql-optimize-join-with-filter-and-order-on-different-tables |
||
---|---|---|
.. | ||
fundraising | ||
item | ||
alt_style.rb | ||
application_record.rb | ||
auth_record.rb | ||
auth_user.rb | ||
closet_hanger.rb | ||
closet_list.rb | ||
closet_visibility.rb | ||
color.rb | ||
contribution.rb | ||
item.rb | ||
item_outfit_relationship.rb | ||
nc_mall_record.rb | ||
neopets_connection.rb | ||
neopets_page.rb | ||
outfit.rb | ||
parent_swf_asset_relationship.rb | ||
pet.rb | ||
pet_state.rb | ||
pet_type.rb | ||
species.rb | ||
swf_asset.rb | ||
user.rb | ||
zone.rb |