Rails Caching and Indexes - Paprikas/rails_cheat_sheet GitHub Wiki

If using datetime for sorting, like

Post.order(updated_at: desc)

Consider adding index to it.

If using multiple columns - create corresponding indices with sorting