Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Is it opening the whole file and turning it into a BTree? #88

Open
meSmashsta opened this issue Sep 14, 2022 · 1 comment
Open

Is it opening the whole file and turning it into a BTree? #88

meSmashsta opened this issue Sep 14, 2022 · 1 comment

Comments

@meSmashsta
Copy link

meSmashsta commented Sep 14, 2022

I have read the whole tutorial, I don't know C language and want to clarify, did the author opened the file and turned all of the data inside into a BTree in memory?

@zjb617
Copy link

zjb617 commented Oct 24, 2022

In the tutorial, the file organized in the form of several pages, every page could be an internal node or an leaf node, so when the program starts, it loads the file descriptor into memory and in the program there is a struct named Pagerto store all the page pointers, when you want to get a page(like when you execute select), if the pointer is null, it means never load the page before, so it allocate some memory to store the page, and if not null, it means you load it before, so it just return the page address.

So I think the author opened the file, but didn't load all the data into memory at once.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants