Adding support for cross-cluster associations to Rails 7
Blog post from GitHub
GitHub has made significant strides in enhancing the Rails framework by addressing the challenges of handling associations across multiple databases. By extracting internal functionality to disable join queries when associations span different databases, GitHub has improved the framework's capability to manage data across 30 databases, each with distinct schemas. This initiative involved implementing non-join queries in Rails, allowing for more efficient querying when data is partitioned functionally rather than horizontally sharded. GitHub developed an internal gem to disable joins for cross-database associations, which was later refined and integrated into Rails as an option called `disable_joins`. This option allows Rails to perform separate queries for each database connection instead of a single join query, thereby supporting applications that use multiple databases. While the new feature may lead to slower database performance for associations due to multiple queries, it empowers applications to scale effectively as their data and traffic increase. This contribution not only demonstrates GitHub's commitment to reducing technical debt and enhancing their system but also showcases their dedication to contributing back to the Rails community, encouraging further improvements and optimizations.