Performant database tree traversal with Rails
planetscale.com
planetscale.com
I don’t think “we added an in memory cache to reduce roundtrips to the DB” is “solving an interesting performance problem.”
Sigh. Fucking kids on my lawn.
The famous serverless data hosting company uses rails
https://en.m.wikipedia.org/wiki/Nested_set_model
If you can't use recursive CTEs I thought the nested set was the older way to do this. There is a bit of work to maintain the structure but once you set it in place it works really well.
> 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.
And the SQL:
select * from schema_snapshots where id = 20
(...)
schema_snapshots where id = 24
// *thousands more queries*
Why select star here? Surely they mean: SELECT left_parent_id as parent_id FROM schema_snapshots )
UNION
(SELECT right_parent_id as parent_id FROM schema_snapshots)
WHERE id in (1,2,3...)
or something?