Performant database tree traversal with Rails

We recently solved an interesting performance problem in our Rails API when performing a tree traversal.We have some code that figures out a 3-way merge for your database schemas. To do this, we need to calculate a merge base between two schemas (like git!).Our Rails API keeps track of changes to each PlanetScale database schema. We call each of these changes a "schema snapshot," similar to a git commit that stores the state of the schema at a specific time. Each snapshot can have one or two parents. When merging branches, we perform a breadth-first search on the history of each change until we find the common ancestor between both branches. This is the merge base.
Performant database tree traversal with Rails #ruby #rubydeveloper #rubyonrails #database https://rubyonrails.ba/single/performant-database-tree-traversal-with-rails

Nezir Zahirovic

Contractor Ruby On Rails (8+ years) / MCPD .Net / C# / Asp.Net / CSS / SQL / (11 years)

related articles