TE
科技回声
首页24小时热榜最新最佳问答展示工作
GitHubTwitter
首页

科技回声

基于 Next.js 构建的科技新闻平台,提供全球科技新闻和讨论内容。

GitHubTwitter

首页

首页最新最佳问答展示工作

资源链接

HackerNews API原版 HackerNewsNext.js

© 2025 科技回声. 版权所有。

Performant database tree traversal with Rails

53 点作者 samlambert将近 2 年前

5 条评论

mcqueenjordan将近 2 年前
Apologies for being the grumpy guy this morning.<p>I don’t think “we added an in memory cache to reduce roundtrips to the DB” is “solving an interesting performance problem.”
评论 #36701799 未加载
评论 #36700618 未加载
xupybd将近 2 年前
What about the nested set model?<p><a href="https:&#x2F;&#x2F;en.m.wikipedia.org&#x2F;wiki&#x2F;Nested_set_model" rel="nofollow noreferrer">https:&#x2F;&#x2F;en.m.wikipedia.org&#x2F;wiki&#x2F;Nested_set_model</a><p>If you can&#x27;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.
e12e将近 2 年前
I&#x27;m not sure I even understand the sample SQL, given:<p>&gt; 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.<p>And the SQL:<p><pre><code> select * from schema_snapshots where id = 20 (...) schema_snapshots where id = 24 &#x2F;&#x2F; *thousands more queries* </code></pre> Why select star here? Surely they mean:<p><pre><code> 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...) </code></pre> or something?
AYBABTME将近 2 年前
Why not use PlanetScale Boost?
评论 #36702520 未加载
itslennysfault将近 2 年前
Performant ... Rails. Nah.