StatusCode: Our Weekly Programming Newsletter. You're not just a Rubyist, you're a software developer, right? :-) Check out StatusCode Weekly, our language and architecture agnostic newsletter that covers the biggest news across the entire software development world.

RubyFlow The Ruby and Rails community linklog

×

The Ruby and Rails community linklog

Made a library? Written a blog post? Found a useful tutorial? Share it with the Ruby community here or just enjoy what everyone else has found!

Postgres Indexes for ActiveRecord Join Tables in Rails Apps

https://pawelurbanek.com/rails-postgres-join-indexes

Join tables are a common citizen in Ruby on Rails apps. Their use case is to provide many to many relation between database models. Adding correct Postgres indexes on join tables is not obvious. I’ve noticed that some tutorials, Stack Overflow posts, and even Rails itself provide incorrect advice on how to do it. In this tutorial, we’ll look into how compound Postgresql indexes work and how to correctly use them with join tables.

We will start by explaining the basics of join models and later deep dive into analyzing the output of the PostgreSQL EXPLAIN query plan with different database indexes.

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