Обсуждение: B tree index || function information

Поиск
Список
Период
Сортировка

B tree index || function information

От
Rohit Goyal
Дата:
Hi All, 

If we have a table and btree index on it.
I would like to know what specific files and functions are called to insert data into index whenever I want to insert data into a table.

For example, if I insert a anew row into a table, then a new row in index will be inserted. I would like to know the sequential flow of functions or files called to insert data into a btree.

Please give me the flow for both an empty btree or an existing btree with (key, value) pairs.

--
Regards,
Rohit Goyal

Re: B tree index || function information

От
Amit Langote
Дата:
Hi,

On Tue, Nov 19, 2013 at 5:53 PM, Rohit Goyal <rhtgyl.87@gmail.com> wrote:
> Hi All,
>
> If we have a table and btree index on it.
> I would like to know what specific files and functions are called to insert
> data into index whenever I want to insert data into a table.
>
> For example, if I insert a anew row into a table, then a new row in index
> will be inserted. I would like to know the sequential flow of functions or
> files called to insert data into a btree.
>
> Please give me the flow for both an empty btree or an existing btree with
> (key, value) pairs.
>


As suggested elsewhere, it would be really helpful if you could learn
to use gdb for command line debugging and at least one command line
source code navigation tool like cscope. There are many online
resources for that. That way, you can easily follow what people here
on the mailing list might ask you to do like set a breakpoint in a
particular function as a starting point. Otherwise, I think it's
difficult for most people to create a flowchart (with references to
functions and files in which they are listed) or something like that.
Since, it appears you want to make some changes to the code, I think
understanding what's already going on with the help of debugging would
really help.

To answer your specific question regarding empty and existing btree, I
guess you mean build a btree index by the first and insert a row into
a table with a btree index already present.

1) btbuild - builds a new btree index
2) btinsert - insert an index tuple into a btree (from a comment in
the source code - Descend the tree recursively, find the appropriate
location for our new tuple, and put it there)


--
Amit


Re: B tree index || function information

От
Amit Langote
Дата:
On Wed, Nov 20, 2013 at 1:49 PM, Amit Langote <amitlangote09@gmail.com> wrote:
> Hi,
>
> On Tue, Nov 19, 2013 at 5:53 PM, Rohit Goyal <rhtgyl.87@gmail.com> wrote:
>> Hi All,
>>
>> If we have a table and btree index on it.
>> I would like to know what specific files and functions are called to insert
>> data into index whenever I want to insert data into a table.
>>
>> For example, if I insert a anew row into a table, then a new row in index
>> will be inserted. I would like to know the sequential flow of functions or
>> files called to insert data into a btree.
>>
>> Please give me the flow for both an empty btree or an existing btree with
>> (key, value) pairs.
>>
>
>
> As suggested elsewhere, it would be really helpful if you could learn
> to use gdb for command line debugging and at least one command line
> source code navigation tool like cscope. There are many online
> resources for that. That way, you can easily follow what people here
> on the mailing list might ask you to do like set a breakpoint in a
> particular function as a starting point. Otherwise, I think it's
> difficult for most people to create a flowchart (with references to
> functions and files in which they are listed) or something like that.
> Since, it appears you want to make some changes to the code, I think
> understanding what's already going on with the help of debugging would
> really help.
>
> To answer your specific question regarding empty and existing btree, I
> guess you mean build a btree index by the first and insert a row into
> a table with a btree index already present.
>
> 1) btbuild - builds a new btree index
> 2) btinsert - insert an index tuple into a btree (from a comment in
> the source code - Descend the tree recursively, find the appropriate
> location for our new tuple, and put it there)
>
>

And as for the file in which above functions are defined, here you go;

src/backend/access/nbtree/nbtree.c

--
Amit


Re: B tree index || function information

От
Luca Ferrari
Дата:
On Tue, Nov 19, 2013 at 9:53 AM, Rohit Goyal <rhtgyl.87@gmail.com> wrote:

> For example, if I insert a anew row into a table, then a new row in index
> will be inserted. I would like to know the sequential flow of functions or
> files called to insert data into a btree.

So are you going to ask this over and over again?
Have you searched the mailing list archives for something similar?
Did you have a lok at the documentation?
Did you read the READMEs in the source tree as I suggested?
Have you tried to lookup the source code by yourself?

And as I suggested, if your aim is to walk the source code, this is
not the right mailing list.
Oh, and by the way, it is not correct that inserting a table in a row
will _always_ put a row in an index.

Luca


Re: B tree index || function information

От
Rohit Goyal
Дата:
Hi,

I am sorry for so many repeatitive questions. I will study now as you said and than ask my specific doubts.

Regards,
Rohit Goyal


On Wed, Nov 20, 2013 at 8:22 AM, Luca Ferrari <fluca1978@infinito.it> wrote:
On Tue, Nov 19, 2013 at 9:53 AM, Rohit Goyal <rhtgyl.87@gmail.com> wrote:

> For example, if I insert a anew row into a table, then a new row in index
> will be inserted. I would like to know the sequential flow of functions or
> files called to insert data into a btree.

So are you going to ask this over and over again?
Have you searched the mailing list archives for something similar?
Did you have a lok at the documentation?
Did you read the READMEs in the source tree as I suggested?
Have you tried to lookup the source code by yourself?

And as I suggested, if your aim is to walk the source code, this is
not the right mailing list.
Oh, and by the way, it is not correct that inserting a table in a row
will _always_ put a row in an index.

Luca



--
Regards,
Rohit Goyal