惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

爱范儿
爱范儿
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
WordPress大学
WordPress大学
Apple Machine Learning Research
Apple Machine Learning Research
小众软件
小众软件
雷峰网
雷峰网
博客园 - 聂微东
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
博客园 - 三生石上(FineUI控件)
博客园_首页
博客园 - 司徒正美
博客园 - 叶小钗
IT之家
IT之家
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
Hugging Face - Blog
Hugging Face - Blog
Last Week in AI
Last Week in AI
博客园 - 【当耐特】
宝玉的分享
宝玉的分享
有赞技术团队
有赞技术团队
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
T
Tailwind CSS Blog
V
V2EX
The Cloudflare Blog

blag

SQLite prefixes its temp files with `etilqs_` - blag Setsum - order agnostic, additive, subtractive checksum - blag Oldest recorded transaction - blag Replacing a cache service with a database - blag SQLite commits are not durable under default settings - blag PSA: SQLite WAL checksums fail silently and may lose data - blag Rickrolling Turso DB (SQLite rewrite in Rust) - blag Collection of insane and fun facts about SQLite - blag How bloom filters made SQLite 10x faster - blag In search of a faster SQLite - blag Galloping Search - blag Building a distributed log using S3 (under 150 lines of Go) - blag Zero Disk Architecture - blag PSA: Most databases do not do checksums by default - blag PSA: SQLite does not do checksums - blag Disaggregated Storage - a brief introduction - blag Why does SQLite (in production) have such a bad rep? - blag SQLite Slaps - blag Now - blag Learning C - blag Snapshot Testing - blag Win: contribution to libSQL (SQLite) codebase - blag Errata in Hekaton MVCC paper - blag Internet is wholesome: MVCC edition - blag It is becoming difficult for me to be productive in Python - blag MongoDB secondary only index - blag Introducing CaskDB – a project to teach you writing a key-value store - blag Recurse Center: Winter Break - blag Recurse Center Day 24: Hacking Go compiler to add a new keyword - blag Recurse Center Day 20: Django v4 upgrade (from v1) - blag
Recurse Center Day 11: B Tree Insertions - blag
2021-11-16 · via blag

This is a draft post that I have prematurely published. Currently, I am attending RC and I want to write as much as possible, log my daily learnings and activities. But, I also don't want to spend time on grammar and prose, so I am publishing all the posts which usually I'd have kept in my draft folder.

I was having trouble with the B Tree insertion algorithm. Here is what I was trying to do:

  1. The first phase was almost similar to search. Start with the root, find the appropriate key.
  2. Traverse down to the internal nodes, down to the leaf node
  3. Insert in the leaf node. If the node overflows, split the node
  4. (this part I was still coding, having difficulty with) If there is a node split, propagate this information upwards
  5. Recursively split if needed, all the way up to root

But the algorithm given in the CLRS is slightly different:

As with a binary search tree, we can insert a key into a B-tree in a single pass down the tree from the root to a leaf. To do so, we do not wait to find out whether we will actually need to split a full node in order to do the insertion. Instead, as we travel down the tree searching for the position where the new key belongs, we split each full node we come to along the way (including the leaf itself). Thus whenever we want to split a full node y, we are assured that its parent is not full.

  1. If the root is full, split it
  2. Find the internal node. If it is full, split it
  3. Keep on splitting till you find the leaf node
  4. Since you have been splitting along the way, no more splits can happen when you insert in the leaf

This is way easier!

  1. What I was trying to do was, bottom up approach and this one seems like top down
  2. I am not sure why, but I find this easier to code top down approach

While this is easier, this will split the root (or internal nodes) even though it is not needed. I was trying to optimise this, as to why split it unnecessarily.

I also consulted the assignments of few of the online courses:

  1. CMU Databases 15445: 2020 version (other versions seem to be asking to implement a Hash Index) has an assignment on B Trees, but it does not address this. I guess it’s up to the person who is implementing. However, I haven’t checked the assignment code yet.
  2. Berkeley CS186: The assignment is to implement a B Tree, but does not include more details.
  3. Utah CS6530: This goes really well into the details. They refer to Database Management Systems which neatly explain how to propagate the details to the parent.

Javascript Arrow Functions

I paired with Tal and Nicole to get some basic understanding of arrow functions. I don’t know JS enough, but now I learned how to use arrow functions!

Here are the two resources which helped me understand them better: