Tune Your Database

Your database server can be either a liability or an asset to performance. If you use one of the modern SQL databases, don’t treat it as a dumb storage mechanism. We have seen in Offload Work to the Database how rewriting Ruby code into SQL can give you one or more orders of magnitude improvement.

But equally important is having your database server tuned up for optimal performance. You’ll want to do this, because the default settings are usually inadequate, especially for PostgreSQL.

Example: Tune Up PostgreSQL for Optimal Performance

This example is relevant for you only when you have to set up the database server on your own. If you host on Heroku, then you can expect your PostgreSQL to be configured reasonably well. ...

Get Ruby Performance Optimization now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.