Cross-cluster Associations
Most recently, Github Ruby team extracted internal functionality to disable joining queries when an association crossed multiple databases. Prior to our work in this area, Rails had no support for handling associations that spanned across clusters; teams had to write SQL to achieve this.
The overall implementation is relatively small. To accomplish disabling joins, we added an option to has_many :through
associations called disable_joins
. When set to true for an association, Rails will generate separate queries for each database rather than a join query.