# ruby-on-rails
1 post tagged with "ruby-on-rails"
Making Indexes Work For You: Composite Indexes and Query Plans (Part 2)
Part 2 is about the practical side of indexes — the strategy behind using them well. It covers composite indexes and the leftmost prefix rule (the column order genuinely matters, and the first column can do double duty), how to use EXPLAIN to stop guessing whether your index is actually being used, the situations where indexing is the wrong call (small tables, low cardinality, write-heavy tables), and a production gotcha I learned the hard way: adding an index to a huge table isn't a casual operation and needs `algorithm: :concurrently` to avoid locking everything. Basically: "I knew indexes make queries faster — here's everything I didn't know about using them well."
Apr 13, 2026
·
8 min read