RubyFlow The Ruby and Rails community linklog

How to Improve ActiveRecord Query Performance with Subquery Caching

https://pawelurbanek.com/rails-query-caching

Slow database queries are a common performance bottleneck for Ruby on Rails apps. Simplifying a complex query is often not possible due to the underlying business logic. Instead, you can extract parts of a query, cache and reuse them to improve performance. In this tutorial, I’ll describe a range of techniques on how to do it.

We will cover more advanced ActiveRecord and PostgreSQL topics like EXPLAIN ANALYZE, and query plan visualizer tool.

Post a comment

You can use basic HTML markup (e.g. <a>) or Markdown.

As you are not logged in, you will be
directed via GitHub to signup or sign in