…with less sql queries
A Rails application will make a large number of sql queries per page unless steps are taken to mitigate this. This is bad because it degrades the performance of your app, affects your ability to scale, and will cost you money.
Install the New Relic gem to see the sql queries made when loading a page in your app.
Here is what we changed to reduce the number of sql queries per page:
…with appropriate database indexes
Periodically review your database schema column indexes, ensuring that columns used in joins and where clauses have an index. Remove any indexes, ( columns and even tables ) that are not used.
…with appropriate use of caching
…with upgrades
Upgrade to Ruby 2.1 or higher to take advantage of better Garbage Collection.