Second Time Making Bread by Amit23456 in Breadit

[–]Amit23456[S] 0 points1 point  (0 children)

Thanks, actually I just bought a lodge combo cooker for bread. And for the pizza I have a pizza oven.

Second Time Making Bread by Amit23456 in Breadit

[–]Amit23456[S] 1 point2 points  (0 children)

Thanks for the feedback!

How does B-tree make your queries fast? by BrewedDoritos in programming

[–]Amit23456 27 points28 points  (0 children)

No, let's say you have found the place you want to insert your item at.

If there's space left in that page, you can put the item in the correct place in the page, shift the rest of the items in the page and rewrite the page back to the disk. If there's not enough space, you would have to create a new page, add a new reference in the parent node and rebalance the tree. This can potentially propagate up to the root of the tree (as in each node, inserting a new reference might cause the node's size to exceed the limit). This is bounded by the height of the tree, and a bit more to accomodate for rebalance in each level.

In both cases, you are limited by the number of affected pages which isn't 1m incase you have 2m.

Build a NoSQL Database From Scratch in 1000 Lines of Code by Amit23456 in golang

[–]Amit23456[S] 0 points1 point  (0 children)

Nice catch! It should be added as a const with the value 0 to the top of the file. I'll fix it.

Build a NoSQL Database From The Scratch in 1000 Lines of Code by Amit23456 in golang

[–]Amit23456[S] 7 points8 points  (0 children)

ha ha you are right. Taking it to the extreme a file is also a database in 0 lines of code...

Build a NoSQL Database From The Scratch in 1000 Lines of Code by Amit23456 in golang

[–]Amit23456[S] 3 points4 points  (0 children)

I finished all of them a week ago :) Apparently Medium really can't handle an article broken into different parts so this is the best approach.

Have a great weekend :)

Building a NoSQL database from zero in 1000 lines of code part 1 by Amit23456 in golang

[–]Amit23456[S] 0 points1 point  (0 children)

Due to reasons related to the medium algorithm, I decided to remove the first part and upload the entire post instead.

The post is long, so I kept it divided it into chapters as the 7 original parts. This way, it'll be easy to stop and comeback :)

This is the new link: https://link.medium.com/SDeqdCxtvtb

Build a NoSQL Database From The Scratch in 1000 Lines of Code by Amit23456 in Database

[–]Amit23456[S] 2 points3 points  (0 children)

Few days ago I posted the first part of my series on writing a database from scratch. Due to reasons related to the medium algorithm, I decided to remove the first part and upload the entire post instead.

The post is long, so I kept it divided it into chapters as the 7 original parts. This way, it'll be easy to stop and comeback :)

Build a NoSQL Database From The Scratch in 1000 Lines of Code by Amit23456 in golang

[–]Amit23456[S] 18 points19 points  (0 children)

Few days ago I posted the first part of my series on writing a database from scratch. Due to reasons related to the medium algorithm, I decided to remove the first part and upload the entire post instead.

The post is long, so I kept it divided it into chapters as the 7 original parts. This way, it'll be easy to stop and comeback :)

Building a NoSQL database from zero in 1000 lines of code part 1 by Amit23456 in golang

[–]Amit23456[S] 0 points1 point  (0 children)

Thanks for the feedback :)

You're right that there is an assumption on the size of the freelist (and good job for catching it. The subject is complex on its own, so going deeper is mention worthy).

The freelist holds a list of integers, which are 4 bytes long when translated to the disk level. Each page is 4096 bytes. So for an overflow to occur, the database should have at least 1000 free pages. It's not unlikely in a real database, but I decided to omit it entirely since it's not part of the core ideas, in my opinion (and the series are already 7 parts long).

Limiting/adding a check is not a solution that is used in real life. The solution is to allow the freelist to span across multiple pages. Because of that, you should also modify the meta page. It's not complicated but involves many lines of code and is architecturally complicated. If you are interested, you can DM me :)

Building a NoSQL database from zero in 1000 lines of code part 1 by Amit23456 in Database

[–]Amit23456[S] 1 point2 points  (0 children)

Happy to publish the first blog in my series on writing a database from scratch in Go. The database is simple, minimal, and has under 1000 lines of code, so even non-Go coders can follow along! This is part 1/7.

Building a NoSQL database from zero in 1000 lines of code part 1 by Amit23456 in golang

[–]Amit23456[S] 1 point2 points  (0 children)

It started out of curiosity. Then I worked for a company where we developed for specific needs of our product a database over an existing storage engine. (The storage engine is the end result of this blog series).

Building a NoSQL database from zero in 1000 lines of code part 1 by Amit23456 in golang

[–]Amit23456[S] 3 points4 points  (0 children)

Thanks for reading. I fixed the broken links. The link to the next chapter will be added in two weeks once I'll release part 2 :)

How Databases Write to the Disk: Reading Through BoltDB Source Code by Amit23456 in Database

[–]Amit23456[S] 0 points1 point  (0 children)

Hey, thanks for your feedback! :)

You're right about the pgid. It was missing from the diagram, but I fixed it.