知识卡片
最小堆归并有序游标
每个来源提供按键排序的游标,最小堆暂存各游标的首条记录。弹出全局最小键并从原游标补下一条,流式输出始终有序。遇到同键可收集各来源候选交给版本对账。内存只需容纳与来源数量相同的游标头,堆更新为 O(log N)。
这张卡片看不懂?
这张卡片已通过人工审查,不再接受失败反馈。
已有反馈 · 0 条
还没有人提交反馈。
在整书笔记中的位置
原书出处 · 1 处
- Chapter 7. Log-Structured Storage LSM Tree Lookups · 查看原书依据
A multiway merge-sort uses a priority queue, such as min-heap [SEDGEWICK11], that holds up to N elements (where N is the number of iterators), which sorts its contents and prepares the next-in-line smallest element to be returned.
参考来源
- 位置:《Database Internals》Chapter 7. Log-Structured Storage(book-source:extracted/Database Internals A deep-dive into how distributed data systems work (Alex Petrov)/_epub-src/OEBPS/ch07.html#merge_iteration,段 87)
- 结论依据:第 86–110 段给出归并示例、游标头不变量及复杂度。
- 原始内容:A multiway merge-sort uses a priority queue, such as min-heap [SEDGEWICK11], that holds up to N elements (where N is the number of iterators), which sorts its contents and prepares the next-in-line smallest element to be returned.