Rails Performance Tips & Tricks

Igor Kasyanchuk
Dec 9, 2023 • 1 minute read
  • Use size instead of count

    For AR relations, as is considers whether the relation has been loaded already instead of re-doing a COUNT query over and over.

  • Add DB indexes
  • Avoid N+1

Useful gems

See all